[C++] EOF has a location
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Tue May 12 08:17:38 GMT 2020
Hi Jakub,
> On Fri, May 08, 2020 at 11:48:34AM -0400, Nathan Sidwell wrote:
>> 2020-05-08 Nathan Sidwell <nathan@acm.org>
>>
>> gcc/cp/
>> * parser.c (cp_lexer_set_source_position_from_token): EOF has a
>> location too.
>
> This change:
>
>> --- c/gcc/cp/parser.c
>> +++ w/gcc/cp/parser.c
>> @@ -895,10 +895,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer,
>> cp_token *token)
>> static inline void
>> cp_lexer_set_source_position_from_token (cp_token *token)
>> {
>> - if (token->type != CPP_EOF)
>> - {
>> - input_location = token->location;
>> - }
>> + input_location = token->location;
>> }
>>
>> /* Update the globals input_location and the input file stack from LEXER. */
>
> seems to have regressed:
> +FAIL: obj-c++.dg/syntax-error-10.mm -fgnu-runtime (test for errors, line 1)
> +FAIL: obj-c++.dg/syntax-error-10.mm -fgnu-runtime (test for excess errors)
> +FAIL: obj-c++.dg/syntax-error-8.mm -fgnu-runtime (test for errors, line 1)
> +FAIL: obj-c++.dg/syntax-error-8.mm -fgnu-runtime (test for excess errors)
> +FAIL: obj-c++.dg/syntax-error-9.mm -fgnu-runtime (test for errors, line 2)
> +FAIL: obj-c++.dg/syntax-error-9.mm -fgnu-runtime (test for excess errors)
> +FAIL: obj-c++.dg/property/property-neg-6.mm -fgnu-runtime (test for
> errors, line 8)
> +FAIL: obj-c++.dg/property/property-neg-6.mm -fgnu-runtime (test for excess
> errors)
>
> E.g. on syntax-error-8.mm, cc1objplus used to emit:
> syntax-error-8.mm:1:12: error: expected ‘@end’ at end of input
> 1 | @interface A /* { dg-error "expected ..end." } */
> | ^
> and now it emits:
> syntax-error-8.mm:1: error: expected ‘@end’ at end of input
> 1 | @interface A /* { dg-error "expected ..end." } */
> |
> instead (no column at all).
this is PR objc++/95013. Nathan is working on it already.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
More information about the Gcc-patches
mailing list