bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib *.h files require config,h


From: Bruno Haible
Subject: gnulib *.h files require config,h
Date: Tue, 3 Jul 2007 02:55:46 +0200
User-agent: KMail/1.5.4

Hi,

Compiling tar-1.18 on IRIX 6.5 with gcc 2.95.2 (or "cc") leads to this error
during "make check":

make[2]: Entering directory `/build/tar-1.18/tests'
...
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../lib -I../src 
-DLOCALEDIR=\"/opt/share/locale\" -I/opt/include  -g -O2 -c argcv.c
In file included from /usr/include/sys/select.h:80,
                 from /usr/include/sys/bsd_types.h:44,
                 from /usr/include/sys/types.h:373,
                 from /usr/include/unistd.h:277,
                 from ../lib/unistd.h:23,
                 from argcv.h:23,
                 from argcv.c:20:
../lib/string.h:54: parse error before `__dest'
../lib/string.h:81: parse error before `__dst'
make[2]: *** [argcv.o] Error 1
make[2]: Leaving directory `/build/tar-1.18/tests'
make[1]: *** [check-am] Error 2

The error occurs because
  1) gnulib's <string.h> replacement is built, and it contains function
     declarations with 'restrict',
  2) tests/Makefile.am contains twice -I../lib, through the INCLUDES variable,
  3) config.h contains "#define restrict __restrict" but tests/argcv.c does
     not include config.h.

This is pretty much the same situation as in bison's
examples/calc++/calc++-scanner.cc. Again, there are two ways to fix this:
  - Define INCLUDES differently in tests/Makefile.am, or
  - Include config.h in all tests source files.

But I'm getting tired of telling people to change their Makefile.ams just
because they now use gnulib.

The proposal is therefore to make gnulib's replacement headers independent
of config.h, as far as possible:
  - Use some @restrict@ instead of using restrict that is defined by config.h,
  - For all types defined by AC_TYPE_MODE_T, AC_TYPE_OFF_T, AC_TYPE_PID_T, etc.
    copy the definition of that type into the header file that needs it,
    rather than assuming that config.h defined it.

Opinions?

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]