public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "James K. Lowden" <jklowden@schemamania.org>
Cc: gcc@gcc.gnu.org, Michael Matz <matz@suse.de>
Subject: Re: access to include path in front end
Date: Wed, 30 Nov 2022 17:58:53 +0000	[thread overview]
Message-ID: <CAH6eHdR48wM02-fO2NP-fLiqmnfXccTF=wJjrfueJsb02obbzQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.20.2211301537260.24878@wotan.suse.de>

On Wed, 30 Nov 2022 at 15:59, Michael Matz wrote:
> If you're looking at the C frontends for inspiration, then:
>
> c-family/c.opt defines which options are recognized and several specifics
> about them, e.g. for -I it has:
>
> ----
> I
> C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
> -I <dir>        Add <dir> to the end of the main include path.
> ----
>
> (look at some other examples therein, also in common.opt to get a feel).

There is also https://gcc.gnu.org/onlinedocs/gccint/Options.html
describing these files.


> If you're also using the model of a compiler driver (i.e. the gcc program,
> source in gcc.cc) that actually calls compiler (cc1), assembler and
> linker, then you also need to arrange for that program to pass all -I
> options to the compiler proper.  That is done with the spec language, by
> somewhere having '{I*}' in the specs for invoking the cobol compiler.
> E.g. look in gcc.cc for '@c' (matching the file extension) how that entry
> uses '%(cpp_unique_options)', and how cpp_unique_options is defined for
> the specs language:
>
>   INIT_STATIC_SPEC ("cpp_unique_options",       &cpp_unique_options),
>
> and
>
> static const char *cpp_unique_options =
>   "%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %@{I*&F*} %{P} %I\
>
> (the specs language used here is documented in a lengthy comment early in
> gcc.cc, "The Specs Language")


Also documented at https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html

  reply	other threads:[~2022-11-30 17: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 [this message]
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

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='CAH6eHdR48wM02-fO2NP-fLiqmnfXccTF=wJjrfueJsb02obbzQ@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jklowden@schemamania.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).