Paul Eggert wrote: >We don't need all thse definitions of __GNUC_PREREQ, since >regex_internal.h is included before the other .c files are; see >regex.c. Could you please simplify the patch accordingly? Only > >
I've attached hte following for review since I took the liberty of replacing two #if __GNUC__ >= constructs in regex_internal.h with __GNUC_PREREQ calls. 2005-09-15 Derek Price <[EMAIL PROTECTED]> * regcomp.c, regexec.c, regex_internal.c: Back out previous changes, consolidating in... * regex_internal.h: ...this file. Replace two #if __GNUC__ >= X with calls to... (__GNUC_PREREQ): ...this new macro. >(I see you didn't pick up on my features.h idea. That's OK; we can do >it later if people like it....) > > I wasn't completely sure what you meant, thought you might still be trying to elicit comment from others, and wanted a quick fix for my immediate problem. I think I understand what features.h does in a glibc context, but I'm unsure how that would fit into this pure/always_inline issue, much less GNULIB. Regards, Derek -- Derek R. Price CVS Solutions Architect Ximbiot <http://ximbiot.com> v: +1 717.579.6168 f: +1 717.234.3125 <mailto:[EMAIL PROTECTED]>
Index: lib/regcomp.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regcomp.c,v retrieving revision 1.18 diff -u -p -r1.18 regcomp.c --- lib/regcomp.c 15 Sep 2005 19:14:23 -0000 1.18 +++ lib/regcomp.c 15 Sep 2005 20:41:15 -0000 @@ -17,19 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#if !__GNUC_PREREQ (3, 1) -# define always_inline -#endif - static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, Idx length, reg_syntax_t syntax); static void re_compile_fastmap_iter (regex_t *bufp, Index: lib/regexec.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regexec.c,v retrieving revision 1.19 diff -u -p -r1.19 regexec.c --- lib/regexec.c 15 Sep 2005 19:14:23 -0000 1.19 +++ lib/regexec.c 15 Sep 2005 20:41:16 -0000 @@ -17,19 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#if !__GNUC_PREREQ (3, 1) -# define always_inline -#endif - static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, Idx n) internal_function; static void match_ctx_clean (re_match_context_t *mctx) internal_function; Index: lib/regex_internal.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regex_internal.c,v retrieving revision 1.18 diff -u -p -r1.18 regex_internal.c --- lib/regex_internal.c 15 Sep 2005 19:14:23 -0000 1.18 +++ lib/regex_internal.c 15 Sep 2005 20:41:16 -0000 @@ -17,19 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#if !__GNUC_PREREQ (3, 0) -# define pure -#endif - static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, REG_TRANSLATE_TYPE trans, bool icase, Index: lib/regex_internal.h =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/regex_internal.h,v retrieving revision 1.15 diff -u -p -r1.15 regex_internal.h --- lib/regex_internal.h 15 Sep 2005 19:14:23 -0000 1.15 +++ lib/regex_internal.h 15 Sep 2005 20:41:16 -0000 @@ -84,7 +84,16 @@ # define RE_ENABLE_I18N #endif -#if __GNUC__ >= 3 +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#if __GNUC_PREREQ (3, 0) # define BE(expr, val) __builtin_expect (expr, val) #else # define BE(expr, val) (expr) @@ -92,6 +101,10 @@ # define pure #endif +#if !__GNUC_PREREQ (3, 1) +# define always_inline +#endif + /* Number of single byte character. */ #define SBC_MAX 256 @@ -334,7 +347,7 @@ typedef struct Idx idx; /* for BACK_REF */ re_context_type ctx_type; /* for ANCHOR */ } opr; -#if __GNUC__ >= 2 +#if __GNUC_PREREQ (2, 0) re_token_type_t type : 8; #else re_token_type_t type;
_______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib