[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] New GNULIB glob module?
From: |
Derek Price |
Subject: |
Re: [bug-gnulib] New GNULIB glob module? |
Date: |
Sun, 15 May 2005 10:29:13 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Paul Eggert wrote:
>Now for commentary on glob.h.
>
>Derek Price <derek@ximbiot.com> writes:
>
>
>
>>--- ../glibc-2.3.5/posix/glob.h 2004-09-16 20:55:15.000000000 -0400
>>+++ lib/glob_.h 2005-05-13 12:21:39.000000000 -0400
>>@@ -19,29 +19,48 @@
>> #ifndef _GLOB_H
>> #define _GLOB_H 1
>>
>>-#include <sys/cdefs.h>
>>+#ifdef _LIBC
>>+# include <sys/cdefs.h>
>>+#else
>>+# include <sys/types.h>
>>+# include <stddef.h>
>>+# undef __size_t
>>+# define __size_t size_t
>>+#endif
>>
>>
>
>Why do we need to include <sys/types.h> here? All we need is size_t,
>right? And stddef.h gives us that.
>
>
If I don't, I get the following error:
In file included from glob.c:23:
glob.h:107: error: syntax error before "struct"
In file included from /usr/include/errno.h:36,
from glob.c:25:
/usr/include/bits/errno.h:38: error: syntax error before "extern"
Hrm. Tracing this a little farther, it is only <features.h>, or even
the <sys/cdefs.h>, that glob_.h was originally including, and not
<sys/types.h>, which is needed to avoid the above error. <features.h>
appears to define __USE_GNU (which the glob_.h file uses) when
_GNU_SOURCE is defined, but a #define __USE_GNU prior to the include of
<stddef.h> isn't sufficient to do the trick. Have you seen anything
like this before? I can't really tell the difference between
<sys/cdefs.h> and <features.h> with a simple test since they each appear
to include the other. I'm personally inclined to leave the #include
<sys/types.h> since it is the standard header and it seems to fix
things, but perhaps you can give me more information?
>>+/* Some system libraries erroneously define these. */
>>+#undef GLOB_ERR
>>...
>>
>>
>
>Which system libraries are these? Perhaps a comment?
>
>
I don't know. I copied and pasted this comment and the #undef block
from the glob.c file. It was previously placed just prior to the
#include of <glob.h>. This looked the better place for it since I
assumed that we wouldn't want applications using the GNULIB glob module
to issue lots of redefinition warnings.
>>+# define getopt __GLOB_ID (getopt)
>>
>>
>
>Surely this line is spurious and can be removed.
>
>
Done.
>>-#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2
>>+#if !defined _LIBC || !defined __USE_FILE_OFFSET64 || __GNUC__ < 2
>>
>>
>
>Can't we remove at least the "|| __GNUC__ < 2" here? glibc assumes
>recent versions of GCC.
>
>
I'll take your word for it. I've also followed through to remove the
following block:
#if __USE_FILE_OFFSET64 && __GNUC__ < 2
# define glob glob64
# define globfree globfree64
#endif
And replaced this block:
# ifndef __size_t
# if defined __GNUC__ && __GNUC__ >= 2
typedef __SIZE_TYPE__ __size_t;
# ifdef __USE_XOPEN
typedef __SIZE_TYPE__ size_t;
# endif
# else
# include <stddef.h>
# ifndef __size_t
# define __size_t size_t
# endif
# endif
# else
with this block:
# ifndef __size_t
typedef __SIZE_TYPE__ __size_t;
# ifdef __USE_XOPEN
typedef __SIZE_TYPE__ size_t;
# endif
# else
>> extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
>> #endif
>>-
>> #ifdef __USE_LARGEFILE64
>> extern int glob64 (__const char *__restrict __pattern, int __flags,
>> int (*__errfunc) (__const char *, int),
>>
>>
>
>Let's omit this change; it's a different matter.
>
>
Done.
Still withholding my patch. I have one more email to process.
Regards,
Derek
- Re: [bug-gnulib] New GNULIB glob module?, (continued)
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/12
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/13
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/13
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/13
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/14
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/15
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/14
- Re: [bug-gnulib] New GNULIB glob module?,
Derek Price <=
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/16
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/18
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/18
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/14
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/15
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/20
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/23