mirror of
https://review.haiku-os.org/buildtools
synced 2024-11-23 07:18:49 +01:00
[taken from gcc-2.95.3-7-suse]
save/restore warnings during the use of __extension__ git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9583 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a20bf576e7
commit
288e868d9b
@ -205,6 +205,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
|
||||
@ -247,6 +249,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 */
|
||||
|
||||
@ -307,7 +318,7 @@ end ifobjc
|
||||
else
|
||||
error ("argument of `asm' is not a constant string"); }
|
||||
| extension extdef
|
||||
{ pedantic = $<itype>1; }
|
||||
{ RESTORE_WARN_FLAGS ($1); }
|
||||
;
|
||||
|
||||
datadef:
|
||||
@ -448,7 +459,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 ($$); }
|
||||
@ -1015,7 +1026,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.
|
||||
@ -1614,7 +1625,7 @@ component_decl:
|
||||
{ $$ = NULL_TREE; }
|
||||
| extension component_decl
|
||||
{ $$ = $2;
|
||||
pedantic = $<itype>1; }
|
||||
RESTORE_WARN_FLAGS ($1); }
|
||||
;
|
||||
|
||||
components:
|
||||
@ -2426,8 +2437,9 @@ identifiers_or_typenames:
|
||||
|
||||
extension:
|
||||
EXTENSION
|
||||
{ $<itype>$ = pedantic;
|
||||
pedantic = 0; }
|
||||
{ $$ = SAVE_WARN_FLAGS();
|
||||
pedantic = 0;
|
||||
warn_pointer_arith = 0; }
|
||||
;
|
||||
|
||||
ifobjc
|
||||
|
@ -2928,7 +2928,8 @@ macros to replace them with the customary keywords. It looks like this:
|
||||
@end example
|
||||
|
||||
@findex __extension__
|
||||
@samp{-pedantic} causes warnings for many GNU C extensions. You can
|
||||
@samp{-pedantic} and other options cause warnings for many
|
||||
GNU C extensions. You can
|
||||
prevent such warnings within one expression by writing
|
||||
@code{__extension__} before the expression. @code{__extension__} has no
|
||||
effect aside from this.
|
||||
|
Loading…
Reference in New Issue
Block a user