bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
Date: Mon, 19 Feb 2024 22:24:34 +0100	[thread overview]
Message-ID: <4068483.A0I09U8b9p@nimes> (raw)
In-Reply-To: <2de0d2f7-e458-4f3e-bbeb-dee63b5a492f@cs.ucla.edu>

Paul Eggert wrote:
> > writing #include <...> everywhere has
> > very little benefit.
> There is a benefit: it's simpler and would avoid future problems like 
> the one just fixed.

There is also a drawback: Remember why we took the habit of putting all
  #include <system-header.h>
before all
  #include "application-header.h" ?
That is because due to the _GNU_SOURCE, _ALL_SOURCE, etc. macros that
our omnipresent 'extensions' module defines, the system header files define
all sorts of non-standardized symbols, which occasionally lead to
conflicts with application headers. #including the application headers
after the system header guarantees that the application header can do
  #define SP mySP
  #define UP myUP
to get rid of the conflict.

If the programmer were to use #include <...> everywhere and — quite
likely — sort the include statements alphabetically, then half of the
time (on average) this conflict resolution will not work out.

> Whatever guideline we use, either the contributors need to learn the 
> guideline, or we can politely adjust their code once contributed.

The larger part of the problem is not with Gnulib, but with the > 100
packages that use Gnulib. We can occasionally ask / force them to make
one-liner changes on our behalf. But they would not accept if we tell
them to diverge significantly from de-facto conventions that are already
in place for 40 years.

The purpose of this de-facto convention (to use #include <...> only for
system headers) was to avoid the need to add -I options in the Makefile,
here and there. At a time when VPATH builds were not common.

> Currently we have more-complicated guideline, which is that one should 
> use #include <...> for include files in category A, and that you can use 
> either style for files in category B, and that these categories are 
> explained somewhere in the documentation.

True. But this more complicated guideline is already in the programmers'
brains, just with a set A that is a little bit smaller than the one Gnulib
needs. The Gnulib documentation is telling the programmer to adjust their
remembered rule for #include, to accommodate essentially only <error.h>.

> (Also, a file may migrate from 
> category B to category A in the future; this isn't explained yet....)

True, but it won't happen often. Probably once in 2 years, or less


  reply	other threads:[~2024-02-19 21:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17  8:36 [PATCH] math: Silence -Winclude-next-absolute-path warning Collin Funk
2024-02-17 10:51 ` Bruno Haible
2024-02-17 12:26   ` Collin Funk
2024-02-17 13:17     ` Bruno Haible
2024-02-18 12:19     ` Bruno Haible
2024-02-18 12:44       ` syntax-check rule to silence " Bruno Haible
2024-02-18 20:12         ` Collin Funk
2024-02-18 20:33           ` Bruno Haible
2024-02-19  5:02             ` Jim Meyering
2024-02-19 18:11               ` Collin Funk
2024-02-19 18:32                 ` Jim Meyering
2024-02-19  8:45             ` Simon Josefsson via Gnulib discussion list
2024-02-19 20:39               ` Jim Meyering
2024-02-20 15:17               ` Bruno Haible
2024-02-20 20:23         ` Collin Funk
2024-02-20 20:49           ` Bruno Haible
2024-02-19  6:31       ` [PATCH] math: Silence " Paul Eggert
2024-02-19 11:03         ` Bruno Haible
2024-02-19 20:41           ` Paul Eggert
2024-02-19 21:24             ` Bruno Haible [this message]
2024-02-19 21:45               ` Paul Eggert

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:

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4068483.A0I09U8b9p@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \


* 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).