public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: "James K. Lowden" <jklowden@schemamania.org>
Cc: gcc@gcc.gnu.org
Subject: Re: access to include path in front end
Date: Mon, 5 Dec 2022 14:01:14 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LSU.2.20.2212051351000.24964@wotan.suse.de> (raw)
In-Reply-To: <20221202132756.49d8dff47218676c0f43eff5@schemamania.org>

Hey,

On Fri, 2 Dec 2022, James K. Lowden wrote:

> > > 3.  Correct the entries in the default_compilers array.  Currently I
> > > have in cobol/lang-specs.h:
> > > 
> > >     {".cob", "@cobol", 0, 0, 0},
> > >     {".COB", "@cobol", 0, 0, 0},
> > >     {".cbl", "@cobol", 0, 0, 0},
> > >     {".CBL", "@cobol", 0, 0, 0},
> > >     {"@cobol", 
> > > 	"cobol1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}", 
> > > 	0, 0, 0}, 
> > 
> > It misses %(cpp_unique_options) which was the reason why your -I
> > arguments weren't passed to cobol1.  
> 
> If I understood you correctly, I don't need to modify gcc.cc.  I only
> need to modify cobol/lang-specs.h, which I've done.  But that's
> evidently not all I need to do, because it doesn't seem to work.  
> 
> The last element in the fragment in cobol/lang-specs.h is now: 
> 
>     {"@cobol",
> 	"cobol1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)} "
> 	"%(cpp_unique_options) ",

%(invoke_as) needs to be last.  What it does is effectively add this to 
the command line (under certain conditions): "-somemoreoptions | as".  
Note the pipe symbol.  Like in normal shell commands also the gcc driver 
interprets this as "and now start the following command as well connection 
stdout of the first to stdin of the second".  So all in all the generated 
cmdline will be somewhat like:

  cobol1 input.cbl -stuff-from-cc1-options | as - -stuff-from-cpp-options

Your cpp_unique_options addition will effectively be options to that 'as' 
command, but you wanted it to be options for cobol1.  So, just switch 
order of elements.

> I see the -B and -I options, and others, with their arguments, contained
> in COLLECT_GCC_OPTIONS on lines 9 and 11.  I guess that represents an
> environment string?

Yes.  It's our round-about-way of passing the gcc options as the user gave 
them downwards in case collect2 (a wrapper for the linking step for, gah, 
don't ask) needs to call gcc itself recursively.  But in the -### (or -v) 
output, if the assembler is invoked in your example (i.e. cobol1 doesn't 
fail for some reason) you should see your -I options being passed to that 
one (wrongly so, of course :) ).


Ciao,
Michael.

      reply	other threads:[~2022-12-05 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 15:08 James K. Lowden
2022-11-30  7:49 ` Richard Biener
2022-11-30 17:18   ` James K. Lowden
2022-11-30 15:58 ` Michael Matz
2022-11-30 17:58   ` Jonathan Wakely
2022-12-01 16:11   ` James K. Lowden
2022-12-01 17:14     ` Michael Matz
2022-12-02 18:27       ` James K. Lowden
2022-12-05 14:01         ` Michael Matz [this message]

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=alpine.LSU.2.20.2212051351000.24964@wotan.suse.de \
    --to=matz@suse.de \
    --cc=gcc@gcc.gnu.org \
    --cc=jklowden@schemamania.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).