public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition [not found] <bug-45331-4@http.gcc.gnu.org/bugzilla/> @ 2010-11-20 18:50 ` froydnj at gcc dot gnu.org 2010-12-07 14:38 ` froydnj at gcc dot gnu.org 2011-09-08 15:18 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: froydnj at gcc dot gnu.org @ 2010-11-20 18:50 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331 --- Comment #2 from Nathan Froyd <froydnj at gcc dot gnu.org> 2010-11-20 18:50:05 UTC --- Author: froydnj Date: Sat Nov 20 18:50:00 2010 New Revision: 166977 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166977 Log: gcc/c-family/ PR c++/16189 PR c++/36888 PR c++/45331 * c-common.h (keyword_begins_type_specifier): Declare. (keyword_is_storage_class_specifier): Declare. (keyword_is_type_qualifier): Declare. * c-common.c (keyword_begins_type_specifier): New function. (keyword_is_storage_class_specifier): New function. (keyword_is_type_qualifier): Declare. gcc/cp/ PR c++/16189 PR c++/36888 PR c++/45331 * parser.c (cp_lexer_set_token_position): New function. (cp_lexer_previous_token_position): New function. (cp_lexer_previous_token): Call it. (cp_parser_class_specifier): Try to gracefully handle a missing semicolon. gcc/testsuite/ PR c++/16189 PR c++/36888 PR c++/45331 * g++.dg/parse/semicolon3.C: New test. * g++.dg/debug/pr22514.C: Adjust. * g++.dg/init/error1.C: Adjust. * g++.dg/other/bitfield3.C: Adjust. * g++.dg/other/semicolon.C: Adjust. * g++.dg/parse/error14.C: Adjust. * g++.dg/parse/error5.C: Adjust. * g++.dg/parse/parameter-declaration-1.C: Adjust. * g++.dg/template/pr23510.C: Adjust. * g++.dg/template/pr39425.C: Adjust. * g++.old-deja/g++.robertl/eb125.C: Adjust. Added: trunk/gcc/testsuite/g++.dg/parse/semicolon3.C Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/c-family/c-common.h trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/debug/pr22514.C trunk/gcc/testsuite/g++.dg/init/error1.C trunk/gcc/testsuite/g++.dg/other/bitfield3.C trunk/gcc/testsuite/g++.dg/other/semicolon.C trunk/gcc/testsuite/g++.dg/parse/error14.C trunk/gcc/testsuite/g++.dg/parse/error5.C trunk/gcc/testsuite/g++.dg/parse/parameter-declaration-1.C trunk/gcc/testsuite/g++.dg/template/pr23510.C trunk/gcc/testsuite/g++.dg/template/pr39425.C trunk/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition [not found] <bug-45331-4@http.gcc.gnu.org/bugzilla/> 2010-11-20 18:50 ` [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition froydnj at gcc dot gnu.org @ 2010-12-07 14:38 ` froydnj at gcc dot gnu.org 2011-09-08 15:18 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: froydnj at gcc dot gnu.org @ 2010-12-07 14:38 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331 Nathan Froyd <froydnj at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |froydnj at gcc dot gnu.org Resolution| |FIXED --- Comment #3 from Nathan Froyd <froydnj at gcc dot gnu.org> 2010-12-07 14:37:57 UTC --- Fixed. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition [not found] <bug-45331-4@http.gcc.gnu.org/bugzilla/> 2010-11-20 18:50 ` [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition froydnj at gcc dot gnu.org 2010-12-07 14:38 ` froydnj at gcc dot gnu.org @ 2011-09-08 15:18 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: redi at gcc dot gnu.org @ 2011-09-08 15:18 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rui.maciel at gmail dot com --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-08 15:16:35 UTC --- *** Bug 50330 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45331] New: Generate clear diagnostics when a semicolon is missing at the end of a class definition @ 2010-08-19 4:47 aaw at gcc dot gnu dot org 2010-08-19 12:11 ` [Bug c++/45331] " redi at gcc dot gnu dot org 0 siblings, 1 reply; 4+ messages in thread From: aaw at gcc dot gnu dot org @ 2010-08-19 4:47 UTC (permalink / raw) To: gcc-bugs [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1360 bytes --] Consider this sample code: # cat tst.cc class X { public: int a; } int foo(const X &x) { return x.a; } The clang front end generates a very nice warning (which is actually color coded for ease of readability): # clang ./tst.cc ./tst.cc:5:2: error: expected ';' after class } ^ ; 1 diagnostic generated. By comparison, this is what gcc generates (in both Crosstool v14 and the current upstream trunk): # ./install/bin/gcc -c tst.cc tst.cc:1:1: error: new types may not be defined in a return type tst.cc:1:1: note: (perhaps a semicolon is missing after the definition of X) tst.cc:7:19: error: two or more data types in declaration of foo True, it *does* mention that there is likely a missing semicolon, but does it really need to mention the other cruft, too? Why not just emit an error about the semicolon, add the missing semicolon to the input stream, and continue parsing the file? -- Summary: Generate clear diagnostics when a semicolon is missing at the end of a class definition Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: aaw at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition 2010-08-19 4:47 [Bug c++/45331] New: " aaw at gcc dot gnu dot org @ 2010-08-19 12:11 ` redi at gcc dot gnu dot org 0 siblings, 0 replies; 4+ messages in thread From: redi at gcc dot gnu dot org @ 2010-08-19 12:11 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from redi at gcc dot gnu dot org 2010-08-19 12:11 ------- Bug 16189 and Bug 36888 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-08 15:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-45331-4@http.gcc.gnu.org/bugzilla/> 2010-11-20 18:50 ` [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition froydnj at gcc dot gnu.org 2010-12-07 14:38 ` froydnj at gcc dot gnu.org 2011-09-08 15:18 ` redi at gcc dot gnu.org 2010-08-19 4:47 [Bug c++/45331] New: " aaw at gcc dot gnu dot org 2010-08-19 12:11 ` [Bug c++/45331] " redi at gcc dot gnu dot 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).