public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: neil@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: preprocessor/3951: need for -MF w/ -M breaks backward compat. w/ documented features.
Date: Sat, 23 Mar 2002 05:26:00 -0000	[thread overview]
Message-ID: <20020323132601.20483.qmail@sources.redhat.com> (raw)

The following reply was made to PR preprocessor/3951; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.demon.co.uk>
To: cgd@broadcom.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/3951: need for -MF w/ -M breaks backward compat. w/ documented features.
Date: Sat, 23 Mar 2002 13:16:56 +0000

 I've cc-ed GNATS.
 
 Chris G. Demetriou wrote:-
 
 > On further testing, not sure that all is happy in 3.0.x with the
 > matches that you made.  (I didn't cc the list/gnats on this, but if
 > you'd like feel free to fwd this msg there.)
 > 
 > 
 > It could be that i've goofed them up applying them to my source tree,
 > but I don't _think_ I did.
 > 
 > 
 > For a file foo.c and foo.S with 'junk' contents, what does:
 > 
 > 	gcc -MMD -c -o foo.o $@
 > 
 > produce for you?
 > 
 > similarly, what if you say "-E" instead of -c?
 > 
 > 
 > in my little world, for the .c / -c case, things are fine.
 > 
 > for the .c / -E, .S / -c, and .S / -E cases, the the preprocessed
 > output is zero-length (leading to ... not the right thing in the .S /
 > -c case, especially 8-).
 
 Wah! It works now! And with -save-temps!!  Happy!!!  I've done
 everything I can think of to break it, and compared everything with
 2.95.4; and it's all matching.
 
 The final patch I sent you seems to be the holy grail.  It gets the
 above right, fixes the 2.95 issues we wanted to avoid, and handles -MF,
 -MQ and -MT like we want.  For the benefit of GNATS, I'll reproduce the
 patch below.  If you could confirm this fixes this issue once and for
 all, I'll apply it to all 3 trees.
 
 Thanks for persevering!
 
 Neil.
 
 Index: gcc.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
 retrieving revision 1.205.2.26
 diff -u -p -r1.205.2.26 gcc.c
 --- gcc.c	2002/03/11 21:38:14	1.205.2.26
 +++ gcc.c	2002/03/23 12:07:37
 @@ -596,8 +596,8 @@ static const char *cpp_options =
  "%{C:%{!E:%eGNU C does not support -C without using -E}}\
   %{std*} %{nostdinc*}\
   %{C} %{v} %{I*} %{P} %{$} %I\
 - %{MD:-M -MF %W{!o: %b.d}%W{o*:%.d%*}}\
 - %{MMD:-MM -MF %W{!o: %b.d}%W{o*:%.d%*}}\
 + %{MD:-MD %W{!o: %b.d}%W{o*:%.d%*}}\
 + %{MMD:-MMD %W{!o: %b.d}%W{o*:%.d%*}}\
   %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
   %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}}\
   %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
 Index: cppinit.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
 retrieving revision 1.147.2.12
 diff -u -p -r1.147.2.12 cppinit.c
 --- cppinit.c	2002/03/11 21:38:18	1.147.2.12
 +++ cppinit.c	2002/03/23 12:07:41
 @@ -1459,10 +1459,16 @@ cpp_handle_option (pfile, argc, argv)
  	  CPP_OPTION (pfile, print_deps_missing_files) = 1;
  	  break;
  	case OPT_M:
 +	  /* When doing dependencies with -M or -MM, suppress normal
 +	     preprocessed output, but still do -dM etc. as software
 +	     depends on this.  Preprocessed output occurs if -MD, -MMD
 +	     or environment var dependency generation is used.  */
  	  CPP_OPTION (pfile, print_deps) = 2;
 +	  CPP_OPTION (pfile, no_output) = 1;
  	  break;
  	case OPT_MM:
  	  CPP_OPTION (pfile, print_deps) = 1;
 +	  CPP_OPTION (pfile, no_output) = 1;
  	  break;
  	case OPT_MF:
  	  CPP_OPTION (pfile, deps_file) = arg;
 @@ -1476,12 +1482,6 @@ cpp_handle_option (pfile, argc, argv)
  	  deps_add_target (pfile->deps, arg, opt_code == OPT_MQ);
  	  break;
  
 -	  /* -MD and -MMD for cpp0 are deprecated and undocumented
 -	     (use -M or -MM with -MF instead), and probably should be
 -	     removed with the next major GCC version.  For the moment
 -	     we allow these for the benefit of Automake 1.4, which
 -	     uses these when dependency tracking is enabled.  Automake
 -	     1.5 will fix this.  */
  	case OPT_MD:
  	  CPP_OPTION (pfile, print_deps) = 2;
  	  CPP_OPTION (pfile, deps_file) = arg;
 @@ -1786,10 +1786,6 @@ init_dependency_output (pfile)
      /* If -M or -MM was seen, default output to wherever was specified
         with -o.  out_fname is non-NULL here.  */
      CPP_OPTION (pfile, deps_file) = CPP_OPTION (pfile, out_fname);
 -
 -  /* When doing dependencies, suppress normal preprocessed output.
 -     Still do -dM, -dI etc. as e.g. glibc depends on this.  */
 -  CPP_OPTION (pfile, no_output) = 1;
  }
  
  static void


             reply	other threads:[~2002-03-23 13:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-23  5:26 Neil Booth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-23 15:46 Neil Booth
2002-03-23 15:36 cgd
2002-03-11 13:37 neil
2002-02-19 23:46 neil
2002-02-19  0:58 neil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020323132601.20483.qmail@sources.redhat.com \
    --to=neil@daikokuya.demon.co.uk \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=neil@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).