toplev.c (check_global_declarations): Don't ask for DECL_ASSEMBLER_NAME unless the...
authorGeoffrey Keating <geoffk@apple.com>
Thu, 3 Jun 2004 23:16:21 +0000 (23:16 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 3 Jun 2004 23:16:21 +0000 (23:16 +0000)
* toplev.c (check_global_declarations): Don't ask for
DECL_ASSEMBLER_NAME unless the function really is declared
static and not defined.

From-SVN: r82611

gcc/ChangeLog
gcc/toplev.c

index 614337b6c942b17881d0e5b9949a91d11fab1ced..db1d4f8fe965e7b0be4886ed50430a76c027726b 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-03  Geoffrey Keating  <geoffk@apple.com>
+
+       * toplev.c (check_global_declarations): Don't ask for
+       DECL_ASSEMBLER_NAME unless the function really is declared
+       static and not defined.
+
 2004-06-03  Matt Austern  <austern@apple.com>
 
        PR c++/15428
index 27f299bb5ef8955be958465f6291276c6553b0fb..afbdb5cf9faf808629c17665e5e8ef3eacf52c09 100644 (file)
@@ -1516,12 +1516,12 @@ check_global_declarations (tree *vec, int len)
         because many programs have static variables
         that exist only to get some text into the object file.  */
       if (TREE_CODE (decl) == FUNCTION_DECL
-         && (warn_unused_function
-             || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
          && DECL_INITIAL (decl) == 0
          && DECL_EXTERNAL (decl)
          && ! DECL_ARTIFICIAL (decl)
-         && ! TREE_PUBLIC (decl))
+         && ! TREE_PUBLIC (decl)
+         && (warn_unused_function
+             || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
        {
          if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
            pedwarn ("%J'%F' used but never defined", decl, decl);