[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] Argp compilation failure with _GNU_SOURCE and optimizat
From: |
Soeren D. Schulze |
Subject: |
Re: [Bug-gnulib] Argp compilation failure with _GNU_SOURCE and optimization |
Date: |
Mon, 6 Sep 2004 14:09:30 +0200 |
Paul Eggert wrote:
> "Soeren D. Schulze" <address@hidden> writes:
(Note: I processed this mail top-to-bottom, so this perhaps does not
matter -- I keep it anyway. For a probable solution, see below.)
> > I am not familiar enough with GCC to tell you what is wrong.
>
> Perhaps if you ran this command:
>
> gcc -E -O3 -D_GNU_SOURCE lib/argp-fmtstream.c
>
> and looked at the output you might see what the __extension__ problem
> is.
Hm, it looks pretty GCC-specific. I formatted it a bit:
1st error (mempcpy.h):
extern void *(__extension__ (__builtin_constant_p (const void *src)
&& __builtin_constant_p (size_t n)
&& ((size_t)(const void *)((const void *src) + 1)
- (size_t)(const void *)(const void *src)
== 1)
&& size_t n <= 8
? __builtin_memcpy (void *dest, const void *src,
size_t n) + (size_t n)
: __mempcpy (void *dest, const void *src,
size_t n)));
2nd error (strndup.h):
extern char *(__extension__ (__builtin_constant_p (const char *string)
&& ((size_t)(const void *)((const char *string)
+ 1)
- (size_t)(const void *)(const char *string)
== 1)
? (((const char *) (const char *string))[0]
== '\0'
? (char *) calloc (1, 1)
: ({
size_t __len = strlen (const char *string)
+ 1;
size_t __n = (size_t n);
char *__retval;
if (__n < __len)
__len = __n + 1;
__retval = (char *) malloc (__len);
if (__retval != ((void *)0))
{
__retval[__len - 1] = '\0';
__retval
= (char *) memcpy (__retval,
const char *string,
__len - 1);
}
__retval;
}))
: __strndup (const char *string, size_t n)));
I do not honestly see a parse error before __extension__.
> > I had checked the sources for obvious errors, but everything looked
> > OK, so I reported this in the hope someone can figure out.
>
> One thought is that some system file has #define'ed mempcpy before
> mempcpy.h was included, to a set of tokens that includes __extension__.
>
> Does it fix things if you insert this line at the start of mempcpy.h:
>
> #ifndef mempcpy
>
> and append this line to the end of that file?
>
> #endif
Yes, it does.
Hm...
In context, I use the Argp gnulib module in my project and call gl_ARGP
in configure.ac. I had been surprised about m4/argp.m4 anyway, because
it does not even check if Argp is present.
mempcpy.h itself contains a check for HAVE_MEMPCPY and strndup.h checks
for HAVE_STRNDUP, but neither gl_FUNC_MEMPCPY nor gl_FUNC_STRNDUP are
required by gl_ARGP.
Calling them by hand works.
Thus, it _is_ a bug, but I had searched in the wrong place.
Thanks,
Soeren Schulze