]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* varasm.c (get_section): Don't die on !DECL_P decl. Tidy error
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Jun 2013 11:13:59 +0000 (11:13 +0000)
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Jun 2013 11:13:59 +0000 (11:13 +0000)
reporting.
(get_named_section): Don't NULL !DECL_P decl.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199949 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/varasm.c

index 52f7e7cf5375062239569b24f6e48143db59d7dc..f346780e5f26b8c1191f4e9f4720b103765f0d45 100644 (file)
@@ -1,3 +1,9 @@
+2013-06-11  Alan Modra  <amodra@gmail.com>
+
+       * varasm.c (get_section): Don't die on !DECL_P decl.  Tidy error
+       reporting.
+       (get_named_section): Don't NULL !DECL_P decl.
+
 2013-06-11  Igor Zamyatin  <igor.zamyatin@intel.com>
 
        * doc/invoke.texi (core-avx2): Document.
index 563953104aa0db2fec0d9754e0b9113e61725cb4..d2b9415477d22e07ab335794f343e6a0bd406e9f 100644 (file)
@@ -307,19 +307,22 @@ get_section (const char *name, unsigned int flags, tree decl)
              return sect;
            }
          /* Sanity check user variables for flag changes.  */
-         if (decl == 0)
-           decl = sect->named.decl;
-         gcc_assert (decl);
-         if (sect->named.decl == NULL)
-           error ("%+D causes a section type conflict", decl);
-         else
+         if (sect->named.decl != NULL
+             && DECL_P (sect->named.decl)
+             && decl != sect->named.decl)
            {
-             error ("%+D causes a section type conflict with %D",
-                    decl, sect->named.decl);
-             if (decl != sect->named.decl)
-               inform (DECL_SOURCE_LOCATION (sect->named.decl),
-                       "%qD was declared here", sect->named.decl);
+             if (decl != NULL && DECL_P (decl))
+               error ("%+D causes a section type conflict with %D",
+                      decl, sect->named.decl);
+             else
+               error ("section type conflict with %D", sect->named.decl);
+             inform (DECL_SOURCE_LOCATION (sect->named.decl),
+                     "%qD was declared here", sect->named.decl);
            }
+         else if (decl != NULL && DECL_P (decl))
+           error ("%+D causes a section type conflict", decl);
+         else
+           error ("section type conflict");
          /* Make sure we don't error about one section multiple times.  */
          sect->common.flags |= SECTION_OVERRIDE;
        }
@@ -409,9 +412,6 @@ get_named_section (tree decl, const char *name, int reloc)
     }
 
   flags = targetm.section_type_flags (decl, name, reloc);
-
-  if (decl && !DECL_P (decl))
-    decl = NULL_TREE;
   return get_section (name, flags, decl);
 }