On 12/04/2023 18:51, Bruno Haible wrote:
Pádraig Brady wrote:
CC       src/cksum-crctab.o
In file included from ./lib/time.h:50,
from /usr/include/sys/time.h:421,
from ./lib/sys/time.h:39,
from /usr/include/sys/select.h:23,
from ./lib/sys/select.h:36,
from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/include/sys/types.h:631,
from ./lib/sys/types.h:39,
from ./lib/stdint.h:105,
from src/crctab.c:1:
./lib/stddef.h:175: error: syntax error before "void"

Ah, this isn't a gnulib issue.
crctab.c in coreutils didn't include <config.h>

While we document that #include <config.h> is a necessity, in
<https://www.gnu.org/software/gnulib/manual/html_node/Source-changes.html>,
we don't enforce it well.

It would have been better if, instead of getting a syntax error,
you would have gotten an error "Please include config.h first.".

We already have such errors in a few places, but apparently not in enough
places.

With the attached patch, you would have gotten an error
   "Please include config.h first."
from
   - the included lib/sys/select.h,
   - the included lib/sys/time.h,
   - the included lib/time.h,
   - the included lib/stddef.h
on that particular platform.

It is well possible — and even the intention — that this patch causes
compilation errors in packages that before compiled fine, on a particular
platform. It will force the package maintainers to add '#include <config.h>'
in some (hopefully most) of the missing places and thus increase the
portability, i.e. reduce the risk of other platform-related compilation
errors.

I like it.
It's better to catch such issues as early as possible.

thanks!
Pádraig


Reply via email to