public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: disquisitiones <disquisitiones@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Modify the gcc exit code for warning
Date: Mon, 30 May 2022 12:32:04 +0000	[thread overview]
Message-ID: <CAH6eHdTMnGw-RqjGs_dCH0ssS-rHE847m4NHF_e7UksRbEoTJA@mail.gmail.com> (raw)
In-Reply-To: <CAAkvOkaJ7JnxFJ_t_+i3d2CkZ8jVLOscZ_27+G2YLXduKE=mzw@mail.gmail.com>

On Sun, 29 May 2022, 18:01 disquisitiones via Gcc-help, <
gcc-help@gcc.gnu.org> wrote:

> Hi and thanks for the hint.
>
> I've determined that the following function defined in gcc/gcc.cc (in
> my understanding the source code related to g++)
>
>
> */* Determine what the exit code of the driver should be.  */*
>
>
> *intdriver::get_exit_code () const { ... }*
>
> is responsible for the return value of g++.
>
> The "warningcount" macro evaluates from the diagnostic context the
> number of warnings generated in the compilation.
>
> The problem is that the warningcount macro evaluates correctly in
> cc1plus but always evaluates to 0 in g++, so it's not
> possible to solve the problem modifying only this function.
>
> So I think that the information about the warning count is lost from
> the diagnostic context of cc1plus
> and the diagnostic context available to g++.
>
> Given that g++ and cc1plus are different applications, I assume that
> cc1plus passes the diagnostic context back to g++ via some temporary
> file.
>

No, the g++ driver spawns a child process to run the cc1plus program, then
the parent waits for the child to exit and gets the exit status from the OS.


And maybe the point could be to make cc1plus update also the warning
> count information in this file, so that it will be available to g++.
>

There is no file.


> Am I on the right track? If so, any hint on where cc1plus stores the
> diagnostic context in this temporary file for g++?
>


Learn about how the fork, exec, and wait functions work. The exit status of
a child process is available to the parent process.



>
>

      reply	other threads:[~2022-05-30 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26  0:35 disquisitiones
2022-05-27 11:46 ` Stefan Ring
2022-05-29 18:00 ` disquisitiones
2022-05-30 12:32   ` Jonathan Wakely [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=CAH6eHdTMnGw-RqjGs_dCH0ssS-rHE847m4NHF_e7UksRbEoTJA@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=disquisitiones@gmail.com \
    --cc=gcc-help@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).