This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Don't write assembler if -fsyntax-only


	* toplev.c:  If flag_syntax_only, don't open or write assembler file.

Index: toplev.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/toplev.c,v
retrieving revision 1.323
diff -u -p -r1.323 toplev.c
--- toplev.c	1998/09/16 18:11:18	1.323
+++ toplev.c	1998/09/23 20:07:19
@@ -2738,7 +2738,9 @@ compile_file (name)
   
   /* Open assembler code output file.  */
 
-  if (! name_specified && asm_file_name == 0)
+  if (flag_syntax_only)
+    asm_out_file = NULL;
+  else if (! name_specified && asm_file_name == 0)
     asm_out_file = stdout;
   else
     {
@@ -2782,32 +2784,37 @@ compile_file (name)
   if (main_input_filename == 0)
     main_input_filename = name;
 
-  ASM_FILE_START (asm_out_file);
+  if (flag_syntax_only)
+    write_symbols = NO_DEBUG;
+  else
+    {
+      ASM_FILE_START (asm_out_file);
 
 #ifdef ASM_COMMENT_START
-  if (flag_verbose_asm)
-    {
-      /* Print the list of options in effect.  */
-      print_version (asm_out_file, ASM_COMMENT_START);
-      print_switch_values (asm_out_file, 0, MAX_LINE,
+      if (flag_verbose_asm)
+	{
+	  /* Print the list of options in effect.  */
+	  print_version (asm_out_file, ASM_COMMENT_START);
+	  print_switch_values (asm_out_file, 0, MAX_LINE,
 			       ASM_COMMENT_START, " ", "\n");
-      /* Add a blank line here so it appears in assembler output but not
-	 screen output.  */
-      fprintf (asm_out_file, "\n");
-    }
+	  /* Add a blank line here so it appears in assembler output but not
+	     screen output.  */
+	  fprintf (asm_out_file, "\n");
+	}
 #endif
 
-  /* Output something to inform GDB that this compilation was by GCC.  */
+      /* Output something to inform GDB that this compilation was by GCC.  */
 #ifndef ASM_IDENTIFY_GCC
-  fprintf (asm_out_file, "gcc2_compiled.:\n");
+      fprintf (asm_out_file, "gcc2_compiled.:\n");
 #else
-  ASM_IDENTIFY_GCC (asm_out_file);
+      ASM_IDENTIFY_GCC (asm_out_file);
 #endif
 
   /* Output something to identify which front-end produced this file.  */
 #ifdef ASM_IDENTIFY_LANGUAGE
-  ASM_IDENTIFY_LANGUAGE (asm_out_file);
+      ASM_IDENTIFY_LANGUAGE (asm_out_file);
 #endif
+    } /* ! flag_syntax_only */
 
 #ifndef ASM_OUTPUT_SECTION_NAME
   if (flag_function_sections)
@@ -2911,6 +2918,9 @@ compile_file (name)
   parse_time -= integration_time;
   parse_time -= varconst_time;
 
+  if (flag_syntax_only)
+    goto finish_syntax;
+
   globals = getdecls ();
 
   /* Really define vars that have had only a tentative definition.
@@ -3153,7 +3163,7 @@ compile_file (name)
 #endif
 
   /* Language-specific end of compilation actions.  */
-
+ finish_syntax:
   lang_finish ();
 
   /* Close the dump files.  */
@@ -3187,7 +3197,8 @@ compile_file (name)
 
   finish_parse ();
 
-  if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
+  if (! flag_syntax_only
+      && (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0))
     fatal_io_error (asm_file_name);
 
   /* Print the times.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]