This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
2.95: Patch to disable some warnings for glibc
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: 2.95: Patch to disable some warnings for glibc
- From: Bernd Schmidt <bernds at cambridge dot redhat dot com>
- Date: Mon, 19 Mar 2001 14:17:52 +0000 (GMT)
This patch should eliminate some unwanted warnings that show up when compiling
X11 on a system with glibc headers. This was proposed for 2.95.3, but left
out since it appeared that the issue with glibc had gone away (the original
report mentioned a prerelease of glibc-2.1). However, while testing the
2.95.3 prereleases I noticed that I still got lots of annoying warnings when
compiling X11. I'm hoping they are fixed now.
Installed on the branch.
Bernd
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.3667.4.337
diff -u -p -r1.3667.4.337 ChangeLog
--- ChangeLog 2001/03/19 13:36:25 1.3667.4.337
+++ ChangeLog 2001/03/19 13:57:35
@@ -1,5 +1,20 @@
2001-03-19 Bernd Schmidt <bernds@redhat.com>
+ 2000-01-18 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+ * c-parse.in (SAVE_WARN_FLAGS): Create an INTEGER_CST.
+ (RESTORE_WARN_FLAGS): Unpack it.
+ Change semantic type of extension to ttype.
+ * c-common.c (split_specs_attrs): Expect an INTEGER_CST.
+ * c-parse.y, c-parse.c, objc/objc-parse.y,
+ objc/objc-parse.c: Regenerate.
+
+ Wed Sep 1 09:12:02 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.
+
Bring back the sjlj eh fixes.
* expr.c (expand_builtin_setjmp_setup): New.
(expand_builtin_setjmp_receiver): New.
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-parse.in,v
retrieving revision 1.16
diff -u -p -r1.16 c-parse.in
--- c-parse.in 1999/04/26 22:35:50 1.16
+++ c-parse.in 2001/03/19 13:57:35
@@ -186,7 +186,7 @@ end ifc
%type <ttype> init maybeasm
%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
%type <ttype> maybe_attribute attributes attribute attribute_list attrib
-%type <ttype> any_word
+%type <ttype> any_word extension
%type <ttype> compstmt
@@ -247,6 +247,17 @@ 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() \
+ build_int_2 (pedantic | (warn_pointer_arith << 1), 0)
+#define RESTORE_WARN_FLAGS(tval) \
+ do { \
+ int val = TREE_INT_CST_LOW (tval); \
+ 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
Index: c-parse.y
[omitted]
Index: c-parse.h
[omitted]
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.56.4.2
diff -u -p -r1.56.4.2 c-common.c
--- c-common.c 1999/09/07 08:11:16 1.56.4.2
+++ c-common.c 2001/03/19 13:57:37
@@ -965,6 +965,15 @@ split_specs_attrs (specs_attrs, declspec
{
tree t, s, a, next, specs, attrs;
+ /* This can happen after an __extension__ in pedantic mode. */
+ if (specs_attrs != NULL_TREE
+ && TREE_CODE (specs_attrs) == INTEGER_CST)
+ {
+ *declspecs = NULL_TREE;
+ *prefix_attributes = NULL_TREE;
+ return;
+ }
+
/* This can happen in c++ (eg: decl: typespec initdecls ';'). */
if (specs_attrs != NULL_TREE
&& TREE_CODE (specs_attrs) != TREE_LIST)
Index: objc/objc-parse.y
[omitted]
Index: objc/objc-parse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/objc/Attic/objc-parse.c,v
retrieving revision 1.17
diff -u -p -r1.17 objc-parse.c
--- objc-parse.c 1999/04/26 22:35:55 1.17
+++ objc-parse.c 2001/03/19 13:57:38
[omitted]