public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] C++ API database
Date: Tue, 18 Oct 2022 13:01:14 +0200	[thread overview]
Message-ID: <CAP3s5k-q_Cu6pcv=ESELaHrd3XSmUNiqHgWwZjY3ZCn1gUsfMw@mail.gmail.com> (raw)
In-Reply-To: <2afc8d88-2c00-a134-7d5d-da6b7c388563@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3024 bytes --]

On Tue, Oct 18, 2022 at 2:56 AM Jason Merrill <jason@redhat.com> wrote:

> That makes sense; the file could say something to that effect.


I did that.



>   Or the
> CSV file could live in the library directory, or a third directory.


The reasoning is that with the file living in the cp subdir we don't have
the situation that the compiler sources depend on something that lives
elsewhere.  Unless I miss something, there are no such outside dependencies
and one can build the compiler without the libstdc++ subdir to exist.




>   And
> maybe separate the two generators; it seems like the code shared between them
> is pretty small.
>

The shared code as-is is small, but so is the whole script.

Unless someone feels strongly about it I'd prefer not to split the file.
It is far easier to forget to make adequate changes in multiple places.
There can be changes to the format going forward and even yet another
consumer of that information.  Keeping more than one (or two, if you count
the CSV file) places is sync is asking for trouble.


The CSV file could use a header row documenting the fields (as well as

> the documentation in the script).
>

I duplicated the information from the script in the CSV file itself.



> > +# This is the file that depends in the generated header file.
>
> s/in/on/
>

Done.


There is one additional issue, though, which will likely not hit anyone
here but theoretically is handled in the current version of the build
infrastructure.

The Makefile contains the provision outside of maintainer mode to rebuild
the generated files by removing the generated file first.  This will
require the tools (gperf) to be available but that's deemed OK.

With this CSV file as the source of the information we have a two-step
derivation of the generated file, though:

CSV -> .gperf -> .h

The trick used to avoid the rebuild of the .h file today is to not have a
prerequisite for the rule.  This doesn't work for the two-step process.  If
the .h and.gperf files are removed there would be no information about the
dependency of the .h generation on the .gperf file.

This is of course not a new problem in general.  GNU make has for a long
time support for order-only prerequisites.  With those one can exactly
express what is needed:

ifeq ($(ENABLE_MAINTAINER_RULES), true)
FOO.h: FOO.gperf
else
FOO.h: | FOO.gperf
endif
        gperf ...

ifeq ($(ENABLE_MAINTAINER_RULES), true)
FOO.gperf: CSV
else
FOO.gperf: | CSV
endif
        python ...

The question here is whether there is a reason not to depend on GNU make
features (and whatever other make implemented this extension).


The alternative would be to not expose the .gperf file at all, remove it
from git and remove it after the .h file was created.  This gets us back to
a one-step process which the unclean make trick can handle.

I haven't found an obvious place where tool dependencies are recorded so I
have no idea what the assumptions are.

Any comment on this?

I have a patch with the order-only rule ready to send out.

  reply	other threads:[~2022-10-18 11:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 11:51 Ulrich Drepper
2022-09-28 16:59 ` Ulrich Drepper
2022-10-18  0:56   ` Jason Merrill
2022-10-18 11:01     ` Ulrich Drepper [this message]
2022-10-18 11:04       ` Martin Liška
2022-10-18 11:15       ` Jakub Jelinek

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='CAP3s5k-q_Cu6pcv=ESELaHrd3XSmUNiqHgWwZjY3ZCn1gUsfMw@mail.gmail.com' \
    --to=drepper@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).