This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,c++] provide intelligent error messages for missing semicolon after class definition


On Fri, Nov 19, 2010 at 10:34 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> On Fri, Nov 19, 2010 at 04:56:57PM +0000, Joseph S. Myers wrote:
>> On Fri, 19 Nov 2010, Nathan Froyd wrote:
>> > (I do not have access to a more recent copy of the spec.)
>>
>> http://www.open-std.org/jtc1/sc22/wg21/ lists N3126 as the most recent
>> C++0x draft.
>
> Thanks. ?I relied too much on Google and was hitting the wrong links in
> any event.
>
>> > These would go in c-common. ?Is that non-controverisal?
>>
>> Yes, so far.
>
> I added keyword_is_type_qualifier in the patch below.
> keyword_is_function_specifier appears to be unnecessary because we can't
> have something like:
>
> struct x { ... } inline func (...) ...
>
> since we can't declare new types in a return type.
>
> Per your suggestion elsewhere, I have also added RID_COMPLEX to
> keyword_begins_type_specifier.
>
>> > I don't know what to do about a common storage_class recognizer. ?We
>> > could either have the c-common function recognize the common subset (the
>> > [dct.stc] identifiers above, plus RID_THREAD). ?The C front-end would
>> > then have to remember RID_TYPEDEF in appropriate places. ?Or we could
>> > silently stuff typedef in there and assume it will DTRT in C++. ?Or we
>> > can just give up on having that code shared between the C and C++ front
>> > ends, and I'll put keyword_is_storage_class_specifier somewhere in the
>> > C++ front end. ?WDYT?
>>
>> Whatever you do, if it goes in common code I think you need a comment
>> carefully explaining the semantics.
>
> I have retained it in common code with a note about the non-inclusion of
> typedef.
>
> OK?
>
> -Nathan
>
> 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.
>

This caused:

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



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]