bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] automatic prototypes


From: Bruno Haible
Subject: Re: [bug-gnulib] automatic prototypes
Date: Sat, 18 Dec 2004 18:53:51 +0100
User-agent: KMail/1.5

Simon Josefsson wrote:
> I guess the controversial aspect is putting too much things into
> config.h...

Yes. It's handy, but it seriously limits the ability to work around problems
on exotic platforms.

In the case of strdup you are lucky because its prototype uses only
built-in types. Even for strlen(), which uses size_t, you would need to
add #include <stddef.h> to config.h.

As you may know, we put the #define _GNU_SOURCE also in config.h, and
it has no effect if another system header has already been included before.
So the config.h will not work if your strlen declaration comes textually
before the _GNU_SOURCE define.

I think it's too thin ice for being a general technique.

> OTOH, alloca.h has always seemed a bit fragile to me, and it might
> actually be better to move that definition to config.h.

Our alloca.h replacement also include <stddef.h>. Same problem.

The only room for improvement that I see would be if autoconf would provide
an AH_BOTTOM macro with priorities, say

   AH_BOTTOM(200,[#include <stddef.h>])
   AH_BOTTOM(10,[#define _GNU_SOURCE])
   AH_BOTTOM(99,[#include <alloca.h>])

which would generate a config.h that looks like this:

   /* Priority 10 */
   #define _GNU_SOURCE
   /* Priority 99 */
   #include <alloca.h>
   /* Priority 200 */
   #include <stddef.h>

This would allow us to define standard priorities for simple #defines,
early include files, normal include files etc.

Bruno





reply via email to

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