OSDN Git Service

* toplev.c (init_asm_output): Add explicit 'b' to mode when
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index 999e096..2741be5 100644 (file)
@@ -43,6 +43,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "line-map.h"
 #include "input.h"
 #include "tree.h"
+#include "version.h"
 #include "rtl.h"
 #include "tm_p.h"
 #include "flags.h"
@@ -1515,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);
@@ -2038,7 +2039,7 @@ init_asm_output (const char *name)
       if (!strcmp (asm_file_name, "-"))
        asm_out_file = stdout;
       else
-       asm_out_file = fopen (asm_file_name, "w+");
+       asm_out_file = fopen (asm_file_name, "w+b");
       if (asm_out_file == 0)
        fatal_error ("can't open %s for writing: %m", asm_file_name);
     }