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

2005-09-15 Thread Derek Price
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  [EMAIL PROTECTED]
 
   * 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:[EMAIL PROTECTED]

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 -   1.17
+++ lib/regcomp.c   15 Sep 2005 19:08:52 -
@@ -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 -   1.18
+++ lib/regexec.c   15 Sep 2005 19:08:52 -
@@ -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.c6 Sep 2005 07:36:48 -   1.17
+++ lib/regex_internal.c15 Sep 2005 19:08:53 -
@@ -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.h6 Sep 2005 17:50:47 -   1.14
+++ lib/regex_internal.h15 Sep 2005 19:08:53 -
@@ -89,6 +89,7 @@
 #else
 # define BE(expr, val) (expr)
 # define inline
+# define pure
 #endif
 
 /* Number of single byte character.  */
___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


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

2005-09-15 Thread Derek Price
Paul Eggert wrote:

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


I know I've already installed this fix but, for future reference, is
there a simple reference I could use to find what version of GCC an
attribute first appeared in?  Something easier than fumbling through the
CVS history, that is.  :)

Thanks,

Derek

-- 
Derek R. Price
CVS Solutions Architect
Ximbiot http://ximbiot.com
v: +1 717.579.6168
f: +1 717.234.3125
mailto:[EMAIL PROTECTED]




___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: gnulib features.h?

2005-09-15 Thread Paul Eggert
Derek Price [EMAIL PROTECTED] writes:

 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.

Let's avoid that, since we want to minimize the differences from glibc.
Other than that, it looks good.  As I understand it, you want the
following change from a day ago.  This is pretty simple.

--- regex_internal.h.~1.14~ 2005-09-15 16:10:09.0 -0700
+++ regex_internal.h2005-09-15 16:13:16.0 -0700
@@ -84,11 +84,25 @@
 # define RE_ENABLE_I18N
 #endif
 
+#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
+
 #if __GNUC__ = 3
 # define BE(expr, val) __builtin_expect (expr, val)
 #else
 # define BE(expr, val) (expr)
 # define inline
+# define pure
 #endif
 
 /* Number of single byte character.  */


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib