Paul Eggert <egg...@cs.ucla.edu> writes:

> That glibc patch needs more work, as I think Gnulib is misusing _LIBC.
> _LIBC means we're using the header while compiling glibc itself,
> whereas obstack.h appears in /usr/include/obstack.h and is used in
> other contexts.

I see.

In lib/cdefs.h there is '#ifndef __GNULIB_CDEFS' and in lib/glob.in.h
there is '# define __GLOB_GNULIB 1'.

Not the most elegant thing in the world, but perhaps gnulib-common.m4
could '#define __GNULIB 1' in config.h and that can be used. That is the
best idea that comes to mind at the moment.

The other idea I had was using _GL_ATTRIBUTE_PURE to detect Gnulib. Both
glibc and Gnulib have:

    #ifndef __attribute_pure__
    # define __attribute_pure__ _GL_ATTRIBUTE_PURE
    #endif

So you could do:

    #ifndef _GL_ATTRIBUTE_PURE
    # define __SMALL_PTRDIFF_T 0
    #endif

Since we #warn if config.h is not included before obstack.h and other
Gnulib replacement headers, this shouldn't cause any ambigous compiler
errors due to missing the definition.

Collin

Reply via email to