Mercurial > hg > octave-shane > gnulib-hg
changeset 16650:8ad751eaba31
regex: allow inclusion of <regex.h> before <limits.h>
Without this patch, portable programs had to include <limits.h> before
<regex.h> if they wanted a consistent value for RE_DUP_MAX.
I ran into this problem with a test version of GNU grep on Solaris 8.
* lib/regex.h: Include <limits.h> if _REGEX_INCLUDE_LIMITS_H.
This is done conditionally so that this change can be merged
back to glibc.
* m4/regex.m4 (gl_REGEX): Define _REGEX_INCLUDE_LIMITS_H if
using the included regex.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 10 Mar 2012 12:15:44 -0800 |
parents | 32ab56c28260 |
children | 6c0da1a4068d |
files | ChangeLog lib/regex.h m4/regex.m4 |
diffstat | 3 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2012-03-10 Paul Eggert <eggert@cs.ucla.edu> + regex: allow inclusion of <regex.h> before <limits.h> + Without this patch, portable programs had to include <limits.h> before + <regex.h> if they wanted a consistent value for RE_DUP_MAX. + I ran into this problem with a test version of GNU grep on Solaris 8. + * lib/regex.h: Include <limits.h> if _REGEX_INCLUDE_LIMITS_H. + This is done conditionally so that this change can be merged + back to glibc. + * m4/regex.m4 (gl_REGEX): Define _REGEX_INCLUDE_LIMITS_H if + using the included regex. + fts: depend on fdopendir * modules/fts (Depends-on): Depend on fdopendir. This is needed on Solaris 8, at least, since it lacks fdopendir. Evidently the
--- a/lib/regex.h +++ b/lib/regex.h @@ -294,6 +294,9 @@ /* Maximum number of duplicates an interval can allow. POSIX-conforming systems might define this in <limits.h>, but we want our value, so remove any previous define. */ +# ifdef _REGEX_INCLUDE_LIMITS_H +# include <limits.h> +# endif # ifdef RE_DUP_MAX # undef RE_DUP_MAX # endif
--- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 60 +# serial 61 # Copyright (C) 1996-2001, 2003-2012 Free Software Foundation, Inc. # @@ -175,6 +175,9 @@ esac if test $ac_use_included_regex = yes; then + AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1], + [Define if you want <regex.h> to include <limits.h>, so that it + consistently overrides <limits.h>'s RE_DUP_MAX.]) AC_DEFINE([_REGEX_LARGE_OFFSETS], [1], [Define if you want regoff_t to be at least as wide POSIX requires.]) AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],