public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44515]  New: improve message for missing ";"
@ 2010-06-13 12:44 manu at gcc dot gnu dot org
  2010-06-13 17:26 ` [Bug c/44515] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-13 12:44 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

Testcase:
void bar(void);
void foo(void)
{
  bar()


}

gcc-4.6:

clang-3.c:7:1: error: expected ‘;’ before ‘}’ token

clang:

t.c:4:8: error: expected ';' after expression
    bar()
         ^
         ;


-- 
           Summary: improve message for missing ";"
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44515


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/44515] improve message for missing ";"
  2010-06-13 12:44 [Bug c/44515] New: improve message for missing ";" manu at gcc dot gnu dot org
@ 2010-06-13 17:26 ` pinskia at gcc dot gnu dot org
  2010-06-13 17:33 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-06-13 17:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-06-13 17:25 -------
Actually before is more correct than saying after bar().  Because expressions
don't need to end on the same line.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44515


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/44515] improve message for missing ";"
  2010-06-13 12:44 [Bug c/44515] New: improve message for missing ";" manu at gcc dot gnu dot org
  2010-06-13 17:26 ` [Bug c/44515] " pinskia at gcc dot gnu dot org
@ 2010-06-13 17:33 ` manu at gcc dot gnu dot org
  2010-06-13 18:25 ` joseph at codesourcery dot com
  2010-06-13 19:33 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-13 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2010-06-13 17:33 -------
(In reply to comment #1)
> Actually before is more correct than saying after bar().  Because expressions
> don't need to end on the same line.

I wonder why people tend to write:

bar();

rather than 

;}

Obviously the second is more correct. ;-)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44515


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/44515] improve message for missing ";"
  2010-06-13 12:44 [Bug c/44515] New: improve message for missing ";" manu at gcc dot gnu dot org
  2010-06-13 17:26 ` [Bug c/44515] " pinskia at gcc dot gnu dot org
  2010-06-13 17:33 ` manu at gcc dot gnu dot org
@ 2010-06-13 18:25 ` joseph at codesourcery dot com
  2010-06-13 19:33 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2010-06-13 18:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from joseph at codesourcery dot com  2010-06-13 18:25 -------
Subject: Re:  improve message for missing ";"

Perhaps "between expression and '}' token" would be more precise.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44515


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/44515] improve message for missing ";"
  2010-06-13 12:44 [Bug c/44515] New: improve message for missing ";" manu at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-06-13 18:25 ` joseph at codesourcery dot com
@ 2010-06-13 19:33 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-13 19:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2010-06-13 19:33 -------
Perhaps, but the location should be at the end of the expression, where most
programmers would put the ';'. Then, mentioning '}', which may be in a totally
different line with a lot comments in between, would be confusing.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44515


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/44515] improve message for missing ";"
       [not found] <bug-44515-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-18  0:11 ` nicola at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-01-18  0:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44515

Nicola Pero <nicola at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nicola at gcc dot gnu.org

--- Comment #5 from Nicola Pero <nicola at gcc dot gnu.org> 2011-01-17 23:34:31 UTC ---
I like Joseph's suggestion - I had been thinking for a while about the C/ObjC
FE 
error messages and came to the same conclusion: ideally it should prominently 
mention the last valid token (that's how you think about the error, the code is 
valid until "bar()", then there is an error), but also mentioning the next, 
unexpected token helps you find the error location when you're looking at the 
code.

So, shall we go for 

 error: missing ‘;’ after expression and before ‘}’

then ?

I guess we'd need to change all the errors in sync.

Thanks


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-17 23:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-13 12:44 [Bug c/44515] New: improve message for missing ";" manu at gcc dot gnu dot org
2010-06-13 17:26 ` [Bug c/44515] " pinskia at gcc dot gnu dot org
2010-06-13 17:33 ` manu at gcc dot gnu dot org
2010-06-13 18:25 ` joseph at codesourcery dot com
2010-06-13 19:33 ` manu at gcc dot gnu dot org
     [not found] <bug-44515-4@http.gcc.gnu.org/bugzilla/>
2011-01-18  0:11 ` nicola at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).