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)
* flow.c (record_active_eh_regions): Terminate loop after finding
......
......@@ -185,6 +185,8 @@ end ifc
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
......@@ -227,6 +229,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */
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
/* Objective-C specific information */
......@@ -297,7 +308,7 @@ end ifobjc
else
error ("argument of `asm' is not a constant string"); }
| extension extdef
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
datadef:
......@@ -438,7 +449,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); }
......@@ -1002,7 +1013,7 @@ decl:
| declmods ';'
{ pedwarn ("empty declaration"); }
| extension decl
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
/* Declspecs which contain at least one type specifier or typedef name.
......@@ -1607,7 +1618,7 @@ component_decl:
{ $$ = NULL_TREE; }
| extension component_decl
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
;
components:
......@@ -2441,8 +2452,9 @@ identifiers_or_typenames:
extension:
EXTENSION
{ $<itype>$ = pedantic;
pedantic = 0; }
{ $$ = SAVE_WARN_FLAGS();
pedantic = 0;
warn_pointer_arith = 0; }
;
ifobjc
......
......@@ -173,6 +173,8 @@ const char * const language_string = "GNU C";
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
......@@ -202,6 +204,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */
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. */
......@@ -256,7 +267,7 @@ extdef:
else
error ("argument of `asm' is not a constant string"); }
| extension extdef
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
datadef:
......@@ -393,7 +404,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); }
......@@ -847,7 +858,7 @@ decl:
| declmods ';'
{ pedwarn ("empty declaration"); }
| extension decl
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
/* Declspecs which contain at least one type specifier or typedef name.
......@@ -1416,7 +1427,7 @@ component_decl:
{ $$ = NULL_TREE; }
| extension component_decl
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
;
components:
......@@ -2246,8 +2257,9 @@ identifiers_or_typenames:
extension:
EXTENSION
{ $<itype>$ = pedantic;
pedantic = 0; }
{ $$ = SAVE_WARN_FLAGS();
pedantic = 0;
warn_pointer_arith = 0; }
;
%%
......@@ -174,6 +174,8 @@ const char * const language_string = "GNU Obj-C";
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
......@@ -214,6 +216,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */
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 */
tree objc_interface_context;
......@@ -280,7 +291,7 @@ extdef:
else
error ("argument of `asm' is not a constant string"); }
| extension extdef
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
datadef:
......@@ -419,7 +430,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); }
......@@ -967,7 +978,7 @@ decl:
| declmods ';'
{ pedwarn ("empty declaration"); }
| extension decl
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
/* Declspecs which contain at least one type specifier or typedef name.
......@@ -1546,7 +1557,7 @@ component_decl:
{ $$ = NULL_TREE; }
| extension component_decl
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
;
components:
......@@ -2378,8 +2389,9 @@ identifiers_or_typenames:
extension:
EXTENSION
{ $<itype>$ = pedantic;
pedantic = 0; }
{ $$ = SAVE_WARN_FLAGS();
pedantic = 0;
warn_pointer_arith = 0; }
;
/* 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