[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] new module "restrict", to fix a porting bug with regex
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] new module "restrict", to fix a porting bug with regex |
Date: |
05 Aug 2003 23:46:21 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Here's a proposed new module "restrict". It fixes a porting bug with
lib/regex.h on some platforms that lack "restrict", or spell it in
some other way. The basic idea is taken from coreutils but I've
changed the name to gl_C_RESTRICT from ACX_C_RESTRICT. We can remove
gl_C_RESTRICT later, after we assume Autoconf 2.57a or later.
--- ChangeLog.~1.70.~ Tue Aug 5 20:52:46 2003
+++ ChangeLog Tue Aug 5 23:44:48 2003
@@ -1,5 +1,9 @@
2003-08-05 Paul Eggert <address@hidden>
+ * modules/restrict, m4/restrict.m4: New files.
+ * MODULES.html.sh (func_all_modules): Add restrict.
+ * modules/regex: Depend on restrict.
+
* MODULES.html.sh (func_all_modules): Remove bumpalloc.
* modules/bumpalloc: Remove.
Index: m4/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ChangeLog,v
retrieving revision 1.468
diff -p -u -r1.468 ChangeLog
--- m4/ChangeLog 6 Aug 2003 06:32:34 -0000 1.468
+++ m4/ChangeLog 6 Aug 2003 06:38:58 -0000
@@ -1,5 +1,7 @@
2003-08-05 Paul Eggert <address@hidden>
+ * regex.m4 (jm_PREREQ_REGEX): Add gl_C_RESTRICT.
+
* regex.m4 (jm_INCLUDED_REGEX): Replace a single non-ASCII
byte with "\201" to avoid glitches when editing that source file
with multi-gnome-terminal.
--- /dev/null Tue Mar 18 13:55:57 2003
+++ modules/restrict Tue Aug 5 22:53:30 2003
@@ -0,0 +1,17 @@
+Description:
+The C99 'restrict' keyword.
+
+Files:
+m4/restrict.m4
+
+Depends-on:
+
+configure.ac:
+gl_C_RESTRICT
+
+Makefile.am:
+
+Include:
+
+Maintainer:
+Paul Eggert and Jim Meyering
--- /dev/null Tue Mar 18 13:55:57 2003
+++ m4/restrict.m4 Tue Aug 5 22:52:43 2003
@@ -0,0 +1,33 @@
+#serial 1002
+# This macro can be removed once we can rely on Autoconf 2.57a or later,
+# since we can then use its AC_C_RESTRICT.
+
+# gl_C_RESTRICT
+# --------------
+# Determine whether the C/C++ compiler supports the "restrict" keyword
+# introduced in ANSI C99, or an equivalent. Do nothing if the compiler
+# accepts it. Otherwise, if the compiler supports an equivalent,
+# define "restrict" to be that. Here are some variants:
+# - GCC supports both __restrict and __restrict__
+# - older DEC Alpha C compilers support only __restrict
+# - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
+# Otherwise, define "restrict" to be empty.
+AC_DEFUN([gl_C_RESTRICT],
+[AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict,
+ [gl_cv_c_restrict=no
+ # Try the official restrict keyword, then gcc's __restrict, and
+ # the less common variants.
+ for ac_kw in restrict __restrict __restrict__ _Restrict; do
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [float * $ac_kw x;])],
+ [gl_cv_c_restrict=$ac_kw; break])
+ done
+ ])
+ case $gl_cv_c_restrict in
+ restrict) ;;
+ no) AC_DEFINE(restrict,,
+ [Define to equivalent of C99 restrict keyword, or to nothing if this
+ is not supported. Do not define if restrict is supported directly.]) ;;
+ *) AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;;
+ esac
+])
Index: MODULES.html.sh
===================================================================
RCS file: /cvsroot/gnulib/gnulib/MODULES.html.sh,v
retrieving revision 1.30
diff -p -u -r1.30 MODULES.html.sh
--- MODULES.html.sh 6 Aug 2003 03:52:46 -0000 1.30
+++ MODULES.html.sh 6 Aug 2003 06:38:54 -0000
@@ -1593,6 +1593,16 @@ func_all_modules ()
func_wrap H2
func_echo "$element"
+ element="Keywords"
+ element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
+ func_section_wrap isoc_sup_keywords
+ func_wrap H3
+ func_echo "$element"
+
+ func_begin_table
+ func_module restrict
+ func_end_table
+
element="Boolean type and values <stdbool.h>"
element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
func_section_wrap isoc_sup_stdbool
Index: m4/regex.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/regex.m4,v
retrieving revision 1.33
diff -p -u -r1.33 regex.m4
--- m4/regex.m4 6 Aug 2003 06:27:39 -0000 1.33
+++ m4/regex.m4 6 Aug 2003 06:38:58 -0000
@@ -1,4 +1,4 @@
-#serial 17
+#serial 18
dnl Initially derived from code in GNU grep.
dnl Mostly written by Jim Meyering.
@@ -110,6 +110,7 @@ AC_DEFUN([jm_PREREQ_REGEX],
dnl Persuade glibc <string.h> to declare mempcpy().
AC_REQUIRE([AC_GNU_SOURCE])
+ AC_REQUIRE([gl_C_RESTRICT])
AC_REQUIRE([AC_FUNC_ALLOCA])
AC_REQUIRE([AC_HEADER_STDC])
AC_CHECK_HEADERS_ONCE(limits.h string.h wchar.h wctype.h)
Index: modules/regex
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/regex,v
retrieving revision 1.3
diff -p -u -r1.3 regex
--- modules/regex 20 Jan 2003 10:02:38 -0000 1.3
+++ modules/regex 6 Aug 2003 06:38:58 -0000
@@ -8,6 +8,7 @@ m4/regex.m4
Depends-on:
alloca
+restrict
unlocked-io
gettext
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gnulib] new module "restrict", to fix a porting bug with regex,
Paul Eggert <=