Commit c3b6e114 by Jim Kingdon Committed by Jeff Law

c-parse.in: save and restore warn_pointer_arith on __extension__ along with pedantic.

       * c-parse.in: save and restore warn_pointer_arith on __extension__
        along with pedantic.
        (SAVE_WARN_FLAGS, RESTORE_WARN_FLAGS): Added.
        Set the type of extension to itype rather than $<itype>1 kludge.
        * extend.texi (Alternate Keywords): Adjust documentation.
        * c-parse.c, c-parse.y, objc-parse.c, objc-parse.y: Rebuilt.

From-SVN: r29588
parent 30439f29
Wed Sep 22 06:25:15 1999 Jim Kingdon <http://developer.redhat.com>
* c-parse.in: save and restore warn_pointer_arith on __extension__
along with pedantic.
(SAVE_WARN_FLAGS, RESTORE_WARN_FLAGS): Added.
Set the type of extension to itype rather than $<itype>1 kludge.
* extend.texi (Alternate Keywords): Adjust documentation.
* c-parse.c, c-parse.y, objc-parse.c, objc-parse.y: Rebuilt.
Wed Sep 22 06:06:57 1999 Jeffrey A Law (law@cygnus.com) Wed Sep 22 06:06:57 1999 Jeffrey A Law (law@cygnus.com)
* flow.c (record_active_eh_regions): Terminate loop after finding * flow.c (record_active_eh_regions): Terminate loop after finding
......
...@@ -185,6 +185,8 @@ end ifc ...@@ -185,6 +185,8 @@ end ifc
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames %type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs %type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
...@@ -227,6 +229,15 @@ static tree declspec_stack; ...@@ -227,6 +229,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */ /* 1 if we explained undeclared var errors. */
static int undeclared_variable_notice; static int undeclared_variable_notice;
/* For __extension__, save/restore the warning flags which are
controlled by __extension__. */
#define SAVE_WARN_FLAGS() (pedantic | (warn_pointer_arith << 1))
#define RESTORE_WARN_FLAGS(val) \
do { \
pedantic = val & 1; \
warn_pointer_arith = (val >> 1) & 1; \
} while (0)
ifobjc ifobjc
/* Objective-C specific information */ /* Objective-C specific information */
...@@ -297,7 +308,7 @@ end ifobjc ...@@ -297,7 +308,7 @@ end ifobjc
else else
error ("argument of `asm' is not a constant string"); } error ("argument of `asm' is not a constant string"); }
| extension extdef | extension extdef
{ pedantic = $<itype>1; } { RESTORE_WARN_FLAGS ($1); }
; ;
datadef: datadef:
...@@ -438,7 +449,7 @@ unary_expr: ...@@ -438,7 +449,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */ /* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY | extension cast_expr %prec UNARY
{ $$ = $2; { $$ = $2;
pedantic = $<itype>1; } RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY | unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0); { $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); } overflow_warning ($$); }
...@@ -1002,7 +1013,7 @@ decl: ...@@ -1002,7 +1013,7 @@ decl:
| declmods ';' | declmods ';'
{ pedwarn ("empty declaration"); } { pedwarn ("empty declaration"); }
| extension decl | extension decl
{ pedantic = $<itype>1; } { RESTORE_WARN_FLAGS ($1); }
; ;
/* Declspecs which contain at least one type specifier or typedef name. /* Declspecs which contain at least one type specifier or typedef name.
...@@ -1607,7 +1618,7 @@ component_decl: ...@@ -1607,7 +1618,7 @@ component_decl:
{ $$ = NULL_TREE; } { $$ = NULL_TREE; }
| extension component_decl | extension component_decl
{ $$ = $2; { $$ = $2;
pedantic = $<itype>1; } RESTORE_WARN_FLAGS ($1); }
; ;
components: components:
...@@ -2441,8 +2452,9 @@ identifiers_or_typenames: ...@@ -2441,8 +2452,9 @@ identifiers_or_typenames:
extension: extension:
EXTENSION EXTENSION
{ $<itype>$ = pedantic; { $$ = SAVE_WARN_FLAGS();
pedantic = 0; } pedantic = 0;
warn_pointer_arith = 0; }
; ;
ifobjc ifobjc
......
...@@ -173,6 +173,8 @@ const char * const language_string = "GNU C"; ...@@ -173,6 +173,8 @@ const char * const language_string = "GNU C";
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames %type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs %type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
...@@ -202,6 +204,15 @@ static tree declspec_stack; ...@@ -202,6 +204,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */ /* 1 if we explained undeclared var errors. */
static int undeclared_variable_notice; static int undeclared_variable_notice;
/* For __extension__, save/restore the warning flags which are
controlled by __extension__. */
#define SAVE_WARN_FLAGS() (pedantic | (warn_pointer_arith << 1))
#define RESTORE_WARN_FLAGS(val) \
do { \
pedantic = val & 1; \
warn_pointer_arith = (val >> 1) & 1; \
} while (0)
/* Tell yyparse how to print a token's value, if yydebug is set. */ /* Tell yyparse how to print a token's value, if yydebug is set. */
...@@ -256,7 +267,7 @@ extdef: ...@@ -256,7 +267,7 @@ extdef:
else else
error ("argument of `asm' is not a constant string"); } error ("argument of `asm' is not a constant string"); }
| extension extdef | extension extdef
{ pedantic = $<itype>1; } { RESTORE_WARN_FLAGS ($1); }
; ;
datadef: datadef:
...@@ -393,7 +404,7 @@ unary_expr: ...@@ -393,7 +404,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */ /* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY | extension cast_expr %prec UNARY
{ $$ = $2; { $$ = $2;
pedantic = $<itype>1; } RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY | unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0); { $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); } overflow_warning ($$); }
...@@ -847,7 +858,7 @@ decl: ...@@ -847,7 +858,7 @@ decl:
| declmods ';' | declmods ';'
{ pedwarn ("empty declaration"); } { pedwarn ("empty declaration"); }
| extension decl | extension decl
{ pedantic = $<itype>1; } { RESTORE_WARN_FLAGS ($1); }
; ;
/* Declspecs which contain at least one type specifier or typedef name. /* Declspecs which contain at least one type specifier or typedef name.
...@@ -1416,7 +1427,7 @@ component_decl: ...@@ -1416,7 +1427,7 @@ component_decl:
{ $$ = NULL_TREE; } { $$ = NULL_TREE; }
| extension component_decl | extension component_decl
{ $$ = $2; { $$ = $2;
pedantic = $<itype>1; } RESTORE_WARN_FLAGS ($1); }
; ;
components: components:
...@@ -2246,8 +2257,9 @@ identifiers_or_typenames: ...@@ -2246,8 +2257,9 @@ identifiers_or_typenames:
extension: extension:
EXTENSION EXTENSION
{ $<itype>$ = pedantic; { $$ = SAVE_WARN_FLAGS();
pedantic = 0; } pedantic = 0;
warn_pointer_arith = 0; }
; ;
%% %%
...@@ -174,6 +174,8 @@ const char * const language_string = "GNU Obj-C"; ...@@ -174,6 +174,8 @@ const char * const language_string = "GNU Obj-C";
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames %type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs %type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
...@@ -214,6 +216,15 @@ static tree declspec_stack; ...@@ -214,6 +216,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */ /* 1 if we explained undeclared var errors. */
static int undeclared_variable_notice; static int undeclared_variable_notice;
/* For __extension__, save/restore the warning flags which are
controlled by __extension__. */
#define SAVE_WARN_FLAGS() (pedantic | (warn_pointer_arith << 1))
#define RESTORE_WARN_FLAGS(val) \
do { \
pedantic = val & 1; \
warn_pointer_arith = (val >> 1) & 1; \
} while (0)
/* Objective-C specific information */ /* Objective-C specific information */
tree objc_interface_context; tree objc_interface_context;
...@@ -280,7 +291,7 @@ extdef: ...@@ -280,7 +291,7 @@ extdef:
else else
error ("argument of `asm' is not a constant string"); } error ("argument of `asm' is not a constant string"); }
| extension extdef | extension extdef
{ pedantic = $<itype>1; } { RESTORE_WARN_FLAGS ($1); }
; ;
datadef: datadef:
...@@ -419,7 +430,7 @@ unary_expr: ...@@ -419,7 +430,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */ /* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY | extension cast_expr %prec UNARY
{ $$ = $2; { $$ = $2;
pedantic = $<itype>1; } RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY | unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0); { $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); } overflow_warning ($$); }
...@@ -967,7 +978,7 @@ decl: ...@@ -967,7 +978,7 @@ decl:
| declmods ';' | declmods ';'
{ pedwarn ("empty declaration"); } { pedwarn ("empty declaration"); }
| extension decl | extension decl
{ pedantic = $<itype>1; } { RESTORE_WARN_FLAGS ($1); }
; ;
/* Declspecs which contain at least one type specifier or typedef name. /* Declspecs which contain at least one type specifier or typedef name.
...@@ -1546,7 +1557,7 @@ component_decl: ...@@ -1546,7 +1557,7 @@ component_decl:
{ $$ = NULL_TREE; } { $$ = NULL_TREE; }
| extension component_decl | extension component_decl
{ $$ = $2; { $$ = $2;
pedantic = $<itype>1; } RESTORE_WARN_FLAGS ($1); }
; ;
components: components:
...@@ -2378,8 +2389,9 @@ identifiers_or_typenames: ...@@ -2378,8 +2389,9 @@ identifiers_or_typenames:
extension: extension:
EXTENSION EXTENSION
{ $<itype>$ = pedantic; { $$ = SAVE_WARN_FLAGS();
pedantic = 0; } pedantic = 0;
warn_pointer_arith = 0; }
; ;
/* Objective-C productions. */ /* Objective-C productions. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment