[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] Re: build failures: string.h vs. HP-UX
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] Re: build failures: string.h vs. HP-UX |
Date: |
Sat, 3 Mar 2007 13:34:05 +0100 |
User-agent: |
KMail/1.5.4 |
Paul Eggert wrote on 2007-01-29:
> > The problem is that regex.h is defining "__restrict" to be "restrict"!
> > ...
> > And of course config.h is defining "restrict" to be "__restrict".
> >
> > #define restrict __restrict
> >
> > That combination is obviously not good.
>
> Thanks for reporting that. I installed this, which I hope fixes
> things for you. I suspect other modules have a similar problem, but
> let's verify that this fix works first.
>
> 2007-01-28 Paul Eggert <address@hidden>
>
> * lib/regex.h (_Restrict_): Renamed from __restrict, to avoid
> a circularity problem with HP-UX ia64 reported by Bob Proulx in
> <http://lists.gnu.org/archive/html/bug-gnulib/2007-01/msg00394.html>.
> All uses changed.
> (_Restrict_arr_): Renamed from __restrict_arr, for similar reasons.
> All uses changed.
> * lib/regcomp.c, lib/regexec.c: Change all uses from __restrict
> to _Restrict_.
> * lib/regexec.c (regexec): Declare pmatch with _Restrict_arr_, so that
> the parameter matches the prototype.
The problem indeed exists also for the 'glob' module. On MacOS X it fails
like this:
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT glob.o -MD -MP -MF .deps/glob.Tpo
-c -o glob.o glob.c
In file included from glob.c:111:
string.h:85: error: parse error before "__dest"
make[1]: *** [glob.o] Error 1
The reasons are the same, except that the definition of __restrict comes
from glob.h. I'm applying this fix. Let's hope, like for regex.h, that
the patch is acceptable for glibc.
2007-03-03 Bruno Haible <address@hidden>
* lib/glob-libc.h (_Restrict_): New macro, copied from lib/regex.h.
All uses of __restrict changed to _Restrict_.
* lib/glob_.h (__restrict): Remove macro.
*** lib/glob-libc.h 10 Jan 2006 21:49:07 -0000 1.2
--- lib/glob-libc.h 3 Mar 2007 12:31:07 -0000
***************
*** 1,4 ****
! /* Copyright (C) 1991,92,95-98,2000,2001,2004-2006 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
--- 1,4 ----
! /* Copyright (C) 1991,92,95-98,2000,2001,2004-2007 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
***************
*** 23,28 ****
--- 23,43 ----
# include <sys/cdefs.h>
#endif
+ /* GCC 2.95 and later have "__restrict"; C99 compilers have
+ "restrict", and "configure" may have defined "restrict".
+ Other compilers use __restrict, __restrict__, and _Restrict, and
+ 'configure' might #define 'restrict' to those words, so pick a
+ different name. */
+ #ifndef _Restrict_
+ # if 199901L <= __STDC_VERSION__
+ # define _Restrict_ restrict
+ # elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
+ # define _Restrict_ __restrict
+ # else
+ # define _Restrict_
+ # endif
+ #endif
+
__BEGIN_DECLS
/* We need `size_t' for the following definitions. */
***************
*** 106,116 ****
#endif
void *(*gl_opendir) (const char *);
#ifdef __USE_GNU
! int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
! int (*gl_stat) (const char *__restrict, struct stat *__restrict);
#else
! int (*gl_lstat) (const char *__restrict, void *__restrict);
! int (*gl_stat) (const char *__restrict, void *__restrict);
#endif
} glob_t;
--- 121,131 ----
#endif
void *(*gl_opendir) (const char *);
#ifdef __USE_GNU
! int (*gl_lstat) (const char *_Restrict_, struct stat *_Restrict_);
! int (*gl_stat) (const char *_Restrict_, struct stat *_Restrict_);
#else
! int (*gl_lstat) (const char *_Restrict_, void *_Restrict_);
! int (*gl_stat) (const char *_Restrict_, void *_Restrict_);
#endif
} glob_t;
***************
*** 135,145 ****
# endif
void *(*gl_opendir) (const char *);
# ifdef __USE_GNU
! int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
! int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
# else
! int (*gl_lstat) (const char *__restrict, void *__restrict);
! int (*gl_stat) (const char *__restrict, void *__restrict);
# endif
} glob64_t;
#endif
--- 150,160 ----
# endif
void *(*gl_opendir) (const char *);
# ifdef __USE_GNU
! int (*gl_lstat) (const char *_Restrict_, struct stat64 *_Restrict_);
! int (*gl_stat) (const char *_Restrict_, struct stat64 *_Restrict_);
# else
! int (*gl_lstat) (const char *_Restrict_, void *_Restrict_);
! int (*gl_stat) (const char *_Restrict_, void *_Restrict_);
# endif
} glob64_t;
#endif
***************
*** 158,182 ****
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
! extern int glob (const char *__restrict __pattern, int __flags,
int (*__errfunc) (const char *, int),
! glob_t *__restrict __pglob) __THROW;
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree (glob_t *__pglob) __THROW;
#else
! extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern,
int __flags,
int (*__errfunc) (const char *, int),
! glob_t *__restrict __pglob), glob64);
extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
#endif
#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
! extern int glob64 (const char *__restrict __pattern, int __flags,
int (*__errfunc) (const char *, int),
! glob64_t *__restrict __pglob) __THROW;
extern void globfree64 (glob64_t *__pglob) __THROW;
#endif
--- 173,197 ----
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
! extern int glob (const char *_Restrict_ __pattern, int __flags,
int (*__errfunc) (const char *, int),
! glob_t *_Restrict_ __pglob) __THROW;
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree (glob_t *__pglob) __THROW;
#else
! extern int __REDIRECT_NTH (glob, (const char *_Restrict_ __pattern,
int __flags,
int (*__errfunc) (const char *, int),
! glob_t *_Restrict_ __pglob), glob64);
extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
#endif
#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
! extern int glob64 (const char *_Restrict_ __pattern, int __flags,
int (*__errfunc) (const char *, int),
! glob64_t *_Restrict_ __pglob) __THROW;
extern void globfree64 (glob64_t *__pglob) __THROW;
#endif
*** lib/glob_.h 11 Jul 2006 06:02:51 -0000 1.6
--- lib/glob_.h 3 Mar 2007 12:31:07 -0000
***************
*** 1,6 ****
/* glob_.h -- Find a path matching a pattern.
! Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Written by Derek Price <address@hidden> & Paul Eggert <address@hidden>
--- 1,6 ----
/* glob_.h -- Find a path matching a pattern.
! Copyright (C) 2005-2007 Free Software Foundation, Inc.
Written by Derek Price <address@hidden> & Paul Eggert <address@hidden>
***************
*** 38,46 ****
#ifndef __size_t
# define __size_t size_t
#endif
- #ifndef __restrict
- # define __restrict restrict
- #endif
#ifndef __USE_GNU
# define __USE_GNU 1
#endif
--- 38,43 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gnulib] Re: build failures: string.h vs. HP-UX,
Bruno Haible <=