[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] Re: automatic prototypes
From: |
Simon Josefsson |
Subject: |
[bug-gnulib] Re: automatic prototypes |
Date: |
Sat, 18 Dec 2004 20:11:49 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> It seems safe to assume that if a
>> gnulib module A depend on another module B, the AH_BOTTOM from module
>> B should come before the one for A.
>
> I don't see a relation between the order in the config.h file and the
> module dependencies.
Not even for the order of AH_BOTTOM statements? If a module A depend
on module B, the AH_BOTTOM statement of module A may need to assume
that the AH_BOTTOM statement from module B has been evaluated. There
is some relation to the dependency order here.
However, I now realize the sorting must be (I believe) a strict
topological sort. Stand-alone modules that provide C89/C99/POSIX
types that other modules implicitly assume must have their AH_BOTTOM
evaluated before the AH_BOTTOM statements from the other modules are
invoked.
For example, consider a module A that provide ptrdiff_t. Module B may
need ptrdiff_t in the header file, i.e., in the AH_BOTTOM statement,
but should probably not depend on ptrdiff_t directly, since that is a
POSIX type that could simply be assumed. However, if an application
has asked for both module A and B, because it want to build on hosts
that doesn't have ptrdiff_t, gnulib-tool must make sure the AH_BOTTOM
for module A is invoked before AH_BOTTOM for module B.
> For example, according to your approach, using the 'gettimeofday' module
> would put a #include <sys/time.h> into config.h.
> And using the 'gettime' module put a #define _GNU_SOURCE 1 into config.h.
> 'gettime' depends on 'gettimeofday' but not vice versa. So by tying the
> the config.h ordering to gnulib module dependencies, the
> #include <sys/time.h> would come before the #define _GNU_SOURCE 1.
> Which is wrong.
Right, but I also said #define's (from AC_CHECK_FUNC, AC_DEFINE etc)
should go first. So gettime would add #define _GNU_SOURCE 1 in the
first part of config.h using AC_GNU_SOURCE, and gettimeofday would add
#include <sys/time.h> using AH_BOTTOM.
But I can see that there may be a potential general problem. If a
module want to modify the behavior of a header file, that another
module include, the first module must use #define's (and not via
AH_BOTTOM) to do so. Including a file, via AH_BOTTOM, that contain
the #define that alter the behavior of the other header file, might
end up too late in the process. I wonder if there are any real
examples of the later, though.
Sorry if I'm unclear, it is sort of difficult to explain this... and
I may be thinking incorrectly as well.
Thanks.
- [bug-gnulib] Re: automatic prototypes, (continued)
- [bug-gnulib] Re: automatic prototypes, Simon Josefsson, 2004/12/17
- Re: [bug-gnulib] Re: automatic prototypes, Paul Eggert, 2004/12/17
- [bug-gnulib] Re: automatic prototypes, Simon Josefsson, 2004/12/17
- Re: [bug-gnulib] Re: automatic prototypes, Paul Eggert, 2004/12/18
- [bug-gnulib] Re: automatic prototypes, Simon Josefsson, 2004/12/18
- Re: [bug-gnulib] Re: automatic prototypes, Paul Eggert, 2004/12/19
Re: [bug-gnulib] automatic prototypes, Bruno Haible, 2004/12/18