This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in g++ --syntax-only
On Tue, Jan 16, 2001 at 09:24:36AM +0000, Jason Merrill wrote:
> >>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
>
> > On Tue, Jan 16, 2001 at 12:24:59AM -0500, Phil Edwards wrote:
> >> > 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?
>
> > Ok.
>
> No, not OK. Please fix this in g++spec.c instead (search for 'warning').
Something like this? (What's the diference?)
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.200
diff -c -3 -p -r1.200 gcc.c
*** gcc.c 2001/01/16 06:06:29 1.200
--- gcc.c 2001/01/16 10:09:42
*************** static char dir_separator_str[] = { DIR_
*** 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;
--- 96,101 ----
*************** process_command (argc, argv)
*** 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. */
--- 3155,3160 ----
*************** process_command (argc, argv)
*** 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;
--- 3781,3786 ----
*************** main (argc, argv)
*** 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",
--- 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",
Index: cp/g++spec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/g++spec.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 g++spec.c
*** g++spec.c 2000/08/02 20:21:26 1.21
--- g++spec.c 2001/01/16 10:09:42
*************** lang_specific_driver (in_argc, in_argv,
*** 156,162 ****
quote = argv[i];
else if (library != 0 && ((argv[i][2] == '\0'
&& (char *) strchr ("cSEM", argv[i][1]) != NULL)
! || strcmp (argv[i], "-MM") == 0))
{
/* Don't specify libraries if we won't link, since that would
cause a warning. */
--- 156,163 ----
quote = argv[i];
else if (library != 0 && ((argv[i][2] == '\0'
&& (char *) strchr ("cSEM", argv[i][1]) != NULL)
! || strcmp (argv[i], "-MM") == 0
! || strcmp (argv[i], "-fsyntax-only") == 0))
{
/* Don't specify libraries if we won't link, since that would
cause a warning. */