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

On Thu, 1 Dec 2022 17:14:31 +0000 (UTC)
Michael Matz <matz@suse.de> 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) ",
	0, 0, 0},

(using string constant concatenation).  That's the only change I made,
so far, because everything we said (AIUI) boiled down to, "just add
cpp_unique_options to your spec string".  

> You would just your new %(cobol_options), or simply '%{v} %{I*}'
> directly in addition to cc1_options.

I didn't do that.  IIUC, the 2nd element in the struct can be a string
constant or the address of a char* variable.  So, I chose a string
constant. 

Getting wiser with age, I used -### to dump the cobol1 command
line.  It appears to be consistent with observed behavior: when I run
under gdb and stop at the cobol1::main function, argc is 14, and argv
does not include the -I option. 

The -### output reports the cobol1 command line (as 14 strings,
exactly) on line 10.  In additon to what was supplied (by me, invoking
gcobol), it shows:

	-quiet
	-dumpdir o- -dumpbase csytst10.cbl 
	-dumpbase-ext .cbl
	"-main=gcc/cobol/prim/samples/CUBES/cobol/csytst10.cbl"
	"-mtune=generic" 
	"-march=x86-64" 
	-o /tmp/ccLYrc6D.s

The -main I can explain later if it matters.  The others are magic I
don't understand and don't think matter, but I show them so you know.  

Note that I'm invoking gcobol from the build tree, using -B (among
others) to make it DTRT.  

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?  Or, anyway, a string that holds the options that
will be passed to collect2?  

The contents of COLLECT_GCC_OPTIONS appear to be a superset of the
options supplied on the cobol1 command line. 

It would seem the single change I made is less than the minimum
required, but I confess I've lost track of why anything more is
needed.  

--jkl

  reply	other threads:[~2022-12-02 18:59 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 [this message]
2022-12-05 14:01         ` Michael Matz

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=20221202132756.49d8dff47218676c0f43eff5@schemamania.org \
    --to=jklowden@schemamania.org \
    --cc=gcc@gcc.gnu.org \
    --cc=matz@suse.de \
    /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).