]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-decl.c (grokdeclarator): Disable warnings for anonymous bitfields.
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 8 Mar 2007 06:48:21 +0000 (06:48 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Thu, 8 Mar 2007 06:48:21 +0000 (06:48 +0000)
gcc/ChangeLog:
* c-decl.c (grokdeclarator): Disable warnings for anonymous
bitfields.
* tree-sra.c (instantiate_element): Propagate disabled warnings
from the element itself to the created variable.
gcc/cp/ChangeLog:
* decl.c (grokdeclarator): Disable warnings for anonymous
bitfields.

From-SVN: r122684

gcc/ChangeLog
gcc/c-decl.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/tree-sra.c

index b3b40ede191aa50b56bcbe1566fe2135c6440686..21c0770da9acb268dfbc2748c8642420fbb8e973 100644 (file)
@@ -1,3 +1,10 @@
+2007-03-08  Alexandre Oliva  <aoliva@redhat.com>
+
+       * c-decl.c (grokdeclarator): Disable warnings for anonymous
+       bitfields.
+       * tree-sra.c (instantiate_element): Propagate disabled warnings
+       from the element itself to the created variable.
+
 2007-03-07  Richard Henderson  <rth@redhat.com>
 
        PR target/30848
index b2bed24afd8771b69eea402c764038890a511e78..0d9fce559e74bfbbae0007f90524b91a0b2ac59b 100644 (file)
@@ -4748,6 +4748,8 @@ grokdeclarator (const struct c_declarator *declarator,
        type = c_build_qualified_type (type, type_quals);
        decl = build_decl (FIELD_DECL, declarator->u.id, type);
        DECL_NONADDRESSABLE_P (decl) = bitfield;
+       if (bitfield && !declarator->u.id)
+         TREE_NO_WARNING (decl) = 1;
 
        if (size_varies)
          C_DECL_VARIABLE_SIZE (decl) = 1;
index 2db8d9cbb858b0160c97c88ee4e0463c7ff3e4af..de0dfd425f1f9d9fd6b7b0d02503d85753c29451 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-08  Alexandre Oliva  <aoliva@redhat.com>
+
+       * decl.c (grokdeclarator): Disable warnings for anonymous
+       bitfields.
+
 2007-03-05  Volker Reichelt  <reichelt@netcologne.de>
 
        * typeck2.c (readonly_error): Always emit a hard error.
index 749cee33589a7a0d5128a82f50fecc57b4f5a9a6..62c1aafef8ed7d3b3ad41dce9881d76bd841e257 100644 (file)
@@ -1,6 +1,6 @@
 /* Process declarations and variables for C++ compiler.
    Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+   2001, 2002, 2003, 2004, 2005, 2006, 2007  Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GCC.
@@ -8539,6 +8539,9 @@ grokdeclarator (const cp_declarator *declarator,
              {
                decl = build_decl (FIELD_DECL, unqualified_id, type);
                DECL_NONADDRESSABLE_P (decl) = bitfield;
+               if (bitfield && !unqualified_id)
+                 TREE_NO_WARNING (decl) = 1;
+
                if (storage_class == sc_mutable)
                  {
                    DECL_MUTABLE_P (decl) = 1;
index ef7707f8b0ddb03116d4b0db8f4b51638a8ab42e..9cf2cef8aa7fc05b84edeec04efaaba44e83cd20 100644 (file)
@@ -1241,6 +1241,8 @@ instantiate_element (struct sra_elt *elt)
       
       DECL_IGNORED_P (var) = 0;
       TREE_NO_WARNING (var) = TREE_NO_WARNING (base);
+      if (elt->element && TREE_NO_WARNING (elt->element))
+       TREE_NO_WARNING (var) = 1;
     }
   else
     {