bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib features.h? (was regex warnings)


From: Derek Price
Subject: Re: gnulib features.h? (was regex warnings)
Date: Thu, 15 Sep 2005 15:17:59 -0400
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Paul Eggert wrote:

>I'd fix it if I were you.  You can use the __GNUC_PREREQ macro of
>md5.h.
>

I've installed the attached patch.  It compiles cleanly on the offending
alpha-linux system.  I pretty-much cut & pasted the __GNUC_PREREQ macro
out of md5.h, as you suggested, and used it, except in regex_internal.h,
where I stumbled across a convenient #if __GNUC__ <= 3 switch already
being used to protect usage of inline, and used that.

2005-09-15  Derek Price  <address@hidden>
 
       * regex_internal.h: Blank `pure' for GNUC < 3.
       * regex_internal.c: Ditto, using this...
       (__GNUC_PREREQ): ...new macro.
       * regcomp.c, regexec.c: Blank `always_inline' for GNUC < 3.1 using...
       (__GNUC_PREREQ): ...this new macro.

Regards,

Derek

-- 
Derek R. Price
CVS Solutions Architect
Ximbiot <http://ximbiot.com>
v: +1 717.579.6168
f: +1 717.234.3125
<mailto:address@hidden>

Index: lib/regcomp.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/regcomp.c,v
retrieving revision 1.17
diff -u -p -r1.17 regcomp.c
--- lib/regcomp.c       6 Sep 2005 07:36:48 -0000       1.17
+++ lib/regcomp.c       15 Sep 2005 19:08:52 -0000
@@ -17,6 +17,19 @@
    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.18
diff -u -p -r1.18 regexec.c
--- lib/regexec.c       6 Sep 2005 07:36:48 -0000       1.18
+++ lib/regexec.c       15 Sep 2005 19:08:52 -0000
@@ -17,6 +17,19 @@
    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.17
diff -u -p -r1.17 regex_internal.c
--- lib/regex_internal.c        6 Sep 2005 07:36:48 -0000       1.17
+++ lib/regex_internal.c        15 Sep 2005 19:08:53 -0000
@@ -17,6 +17,19 @@
    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.14
diff -u -p -r1.14 regex_internal.h
--- lib/regex_internal.h        6 Sep 2005 17:50:47 -0000       1.14
+++ lib/regex_internal.h        15 Sep 2005 19:08:53 -0000
@@ -89,6 +89,7 @@
 #else
 # define BE(expr, val) (expr)
 # define inline
+# define pure
 #endif
 
 /* Number of single byte character.  */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]