On Tue, Nov 29, 2022 at 4:41 PM James K. Lowden
<jklow...@schemamania.org> wrote:
>
> I don't understand how to access in a front end the arguments to the -I
> option on the command line.
>
> Cobol has a feature similar to the C preprecessor, known as the
> Compiler Directing Facility (CDF).  The CDF has a COPY statement that
> resembles an #include directive in C, and shares the property that COPY
> names a file that is normally found in a "copybook" which, for our
> purposes, is a directory of such files.  The name of that directory is
> defined outside the Cobol program.
>
> I would like to use the -I option to pass the names of copybook
> directories to the cobol front end.  A bit of exploration yesterday left
> me with the sense that the -I argument, in C at least, is not passed to
> the compiler, but to the preprocessor. Access to -fmax-errors I think
> I've figured out, but -I is a mystery.
>
> I'm a little puzzled by the status quo as I understand it.  Unless I
> missed it, it's not discussed in gccint.  ISTM ideally there would be
> some kind of getopt(3) processing, and the whole set of command-line
> options captured in an array of structures accessible to any front
> end.  Is that not the case and, if not, why not?

The frontends have access to the set of passed options via the
option processing langhooks (and there's also global_options
and global_options_set), -I would be the OPT_I option (currently
only enabled for some frontends, you can add that in your
language specific .opt file).  The set of include directories is
not in any way special here.

Richard.

> Many thanks.
>
> --jkl

Reply via email to