This is the mail archive of the gcc-bugs@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]

Re: Bug in g++ --syntax-only


On Fri, Jan 12, 2001 at 04:21:16PM -0700, Tom Tromey wrote:
> I was suprised by this:
> 
>     creche. g++ --syntax-only foo.cc 
>     g++: -lstdc++: linker input file unused because linking not done
>     g++: -lm: linker input file unused because linking not done
> 
> I think addition of those -l flags should be disabled when
> --syntax-only is given.  I find these messages counterintuitive.

Same here.  Somebody comment on the below patch?

Phil


Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.199
diff -c -3 -p -r1.199 gcc.c
*** gcc.c	2001/01/10 21:32:15	1.199
--- gcc.c	2001/01/16 05:11:53
*************** static char dir_separator_str[] = { DIR_
*** 96,101 ****
--- 96,104 ----
  
  #define MIN_FATAL_STATUS 1
  
+ /* If nonzero, -fsyntax-only was passed. */
+ static int flag_syntax_only;
+ 
  /* Flag saying to pass the greatest exit code returned by a sub-process
     to the calling program.  */
  static int pass_exit_codes;
*************** process_command (argc, argv)
*** 3155,3160 ****
--- 3158,3168 ----
  	  printf ("%s\n", spec_machine);
  	  exit (0);
  	}
+       else if (strcmp (argv[i], "-fsyntax-only") == 0)
+ 	{
+ 	  /* remember this so we don't complain about libraries */
+ 	  flag_syntax_only = 1;
+ 	}
        else if (strcmp (argv[i], "-fhelp") == 0)
  	{
  	  /* translate_options () has turned --help into -fhelp.  */
*************** process_command (argc, argv)
*** 3781,3786 ****
--- 3789,3795 ----
  	  switches[n_switches].ordering = 0;
  	  /* These are always valid, since gcc.c itself understands it.  */
  	  if (!strcmp (p, "save-temps")
+ 	      || !strcmp (p, "fsyntax-only")
  	      || !strcmp (p, "static-libgcc")
  	      || !strcmp (p, "shared-libgcc"))
  	    switches[n_switches].validated = 1;
*************** main (argc, argv)
*** 5849,5855 ****
    /* If options said don't run linker,
       complain about input files to be given to the linker.  */
  
!   if (! linker_was_run && error_count == 0)
      for (i = 0; (int) i < n_infiles; i++)
        if (explicit_link_files[i])
  	error ("%s: linker input file unused because linking not done",
--- 5858,5864 ----
    /* If options said don't run linker,
       complain about input files to be given to the linker.  */
  
!   if (! linker_was_run && error_count == 0 && flag_syntax_only == 0)
      for (i = 0; (int) i < n_infiles; i++)
        if (explicit_link_files[i])
  	error ("%s: linker input file unused because linking not done",

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