From 80905e10d427a3abdeb61e2677a6cbe0f8ac1aba Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 19 Jan 2011 22:15:41 -0800 Subject: assume , ..., exist For years gnulib has been assuming the existence of the headers , , , , , , , , and . Omit checks for them, since they don't appear to be needed. * README (Portability guidelines): Document this. * lib/flock.c: Assume exists. * lib/regex_internal.h: Assume exists. * m4/ctype.m4 (gl_CTYPE_H): Assume exists. * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Assume exists. * m4/fcntl_h.m4 (gl_FCNTL_H): Assume exists. * m4/flock.m4 (gl_PREREQ_FLOCK): Likewise. * m4/locale_h.m4 (gl_LOCALE_H): Assume exists. * m4/regex.m4 (gl_REGEX): Likewise. * m4/signal_h.m4 (gl_SIGNAL_H): Assume exists. * m4/stdio_h.m4 (gl_STDIO_H): Assume exists. * m4/stdlib_h.m4 (gl_STDLIB_H): Assume exists. * m4/string_h.m4 (gl_STRING_H): Assume exists. * tests/test-argp.c: Likewise. * m4/time_h.m4 (gl_HEADER_TIME_H_BODY): Assume exists. --- ChangeLog | 21 ++++++++++++++++++++ README | 11 +++++++---- lib/flock.c | 2 -- lib/regex_internal.h | 6 ++---- m4/ctype.m4 | 4 ++-- m4/errno_h.m4 | 4 ++-- m4/fcntl_h.m4 | 4 ++-- m4/flock.m4 | 4 ++-- m4/locale_h.m4 | 4 ++-- m4/regex.m4 | 56 +++++++++++++++++++++++----------------------------- m4/signal_h.m4 | 2 +- m4/stdio_h.m4 | 2 +- m4/stdlib_h.m4 | 4 ++-- m4/string_h.m4 | 4 ++-- m4/time_h.m4 | 4 ++-- tests/test-argp.c | 4 +--- 16 files changed, 74 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41a445298f..167680366c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ 2011-01-19 Paul Eggert + assume , ..., exist + For years gnulib has been assuming the existence of the headers + , , , , , + , , , and . Omit checks for + them, since they don't appear to be needed. + * README (Portability guidelines): Document this. + * lib/flock.c: Assume exists. + * lib/regex_internal.h: Assume exists. + * m4/ctype.m4 (gl_CTYPE_H): Assume exists. + * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Assume exists. + * m4/fcntl_h.m4 (gl_FCNTL_H): Assume exists. + * m4/flock.m4 (gl_PREREQ_FLOCK): Likewise. + * m4/locale_h.m4 (gl_LOCALE_H): Assume exists. + * m4/regex.m4 (gl_REGEX): Likewise. + * m4/signal_h.m4 (gl_SIGNAL_H): Assume exists. + * m4/stdio_h.m4 (gl_STDIO_H): Assume exists. + * m4/stdlib_h.m4 (gl_STDLIB_H): Assume exists. + * m4/string_h.m4 (gl_STRING_H): Assume exists. + * tests/test-argp.c: Likewise. + * m4/time_h.m4 (gl_HEADER_TIME_H_BODY): Assume exists. + multiarch: remove AA_APPLE_UNIVERSAL_BUILD * m4/multiarch.m4 (gl_MULTIARCH): Don't AC_DEFINE AA_APPLE_UNIVERSAL_BUILD. See diff --git a/README b/README index 0d8ac6dd88..492827a03e 100644 --- a/README +++ b/README @@ -221,13 +221,16 @@ some point we may start assuming a C89 library as well. Because we assume a freestanding C89 compiler, Gnulib code can include , , , and unconditionally. It -can also include hosted headers like that were present in -Unix Version 7 and are thus widely available. Similarly, many modules -include even though it's not even in C99; that's OK -since has been around nearly forever. and +can also assume the existence of , , , +, , , , , and +. Some of these headers, such as , were present in +Unix Version 7 and are thus widely available. and were not in Unix Version 7, so they weren't universally available on ancient hosts, but they are both in SunOS 4 (the oldest platform still in relatively-common use) so Gnulib assumes them now. +Similarly, many modules include even though it's not +even in C99; that's OK since has been around nearly +forever. Even if the include files exist, they may not conform to C89. However, GCC has a "fixincludes" script that attempts to fix most diff --git a/lib/flock.c b/lib/flock.c index aae7fc624f..7db5663559 100644 --- a/lib/flock.c +++ b/lib/flock.c @@ -163,9 +163,7 @@ flock (int fd, int operation) #ifdef HAVE_STRUCT_FLOCK_L_TYPE /* We know how to implement flock in terms of fcntl. */ -#ifdef HAVE_FCNTL_H #include -#endif #ifdef HAVE_UNISTD_H #include diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 0bd2b97acc..b599cc1199 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -31,9 +31,7 @@ #ifndef _LIBC # include "localcharset.h" #endif -#if defined HAVE_LOCALE_H || defined _LIBC -# include -#endif +#include #include #include @@ -83,7 +81,7 @@ # define SIZE_MAX ((size_t) -1) #endif -#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC +#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC # define RE_ENABLE_I18N #endif diff --git a/m4/ctype.m4 b/m4/ctype.m4 index 603c9db707..4a86ba94ac 100644 --- a/m4/ctype.m4 +++ b/m4/ctype.m4 @@ -1,4 +1,4 @@ -# ctype_h.m4 serial 5 +# ctype_h.m4 serial 6 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_CTYPE_H], AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. - gl_CHECK_NEXT_HEADERS([ctype.h]) + gl_NEXT_HEADERS([ctype.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. diff --git a/m4/errno_h.m4 b/m4/errno_h.m4 index 427c3f25f6..687bafff2d 100644 --- a/m4/errno_h.m4 +++ b/m4/errno_h.m4 @@ -1,4 +1,4 @@ -# errno_h.m4 serial 7 +# errno_h.m4 serial 8 dnl Copyright (C) 2004, 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -50,7 +50,7 @@ booboo if test $gl_cv_header_errno_h_complete = yes; then ERRNO_H='' else - gl_CHECK_NEXT_HEADERS([errno.h]) + gl_NEXT_HEADERS([errno.h]) ERRNO_H='errno.h' fi AC_SUBST([ERRNO_H]) diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index 5df6bbade9..1ef4f455b7 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 12 +# serial 13 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -11,7 +11,7 @@ AC_DEFUN([gl_FCNTL_H], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([gl_FCNTL_O_FLAGS]) - gl_CHECK_NEXT_HEADERS([fcntl.h]) + gl_NEXT_HEADERS([fcntl.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common diff --git a/m4/flock.m4 b/m4/flock.m4 index ba22043654..7d8c7030d1 100644 --- a/m4/flock.m4 +++ b/m4/flock.m4 @@ -1,4 +1,4 @@ -# flock.m4 serial 1 +# flock.m4 serial 2 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,7 @@ dnl Prerequisites of lib/flock.c. AC_DEFUN([gl_PREREQ_FLOCK], [ AC_CHECK_FUNCS_ONCE([fcntl]) - AC_CHECK_HEADERS_ONCE([unistd.h fcntl.h]) + AC_CHECK_HEADERS_ONCE([unistd.h]) dnl Do we have a POSIX fcntl lock implementation? AC_CHECK_MEMBERS([struct flock.l_type],[],[],[[#include ]]) diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index 60e6798db8..a1a0870146 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -1,4 +1,4 @@ -# locale_h.m4 serial 11 +# locale_h.m4 serial 12 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -55,7 +55,7 @@ AC_DEFUN([gl_LOCALE_H], AC_SUBST([HAVE_XLOCALE_H]) dnl is always overridden, because of GNULIB_POSIXCHECK. - gl_CHECK_NEXT_HEADERS([locale.h]) + gl_NEXT_HEADERS([locale.h]) if test -n "$STDDEF_H" \ || test $gl_cv_header_locale_h_posix2001 = no \ diff --git a/m4/regex.m4 b/m4/regex.m4 index 4191acb5de..24198b5570 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 57 +# serial 58 # Copyright (C) 1996-2001, 2003-2011 Free Software Foundation, Inc. # @@ -13,8 +13,6 @@ AC_PREREQ([2.50]) AC_DEFUN([gl_REGEX], [ - AC_CHECK_HEADERS_ONCE([locale.h]) - AC_ARG_WITH([included-regex], [AS_HELP_STRING([--without-included-regex], [don't compile regex; this is the default on systems @@ -34,9 +32,7 @@ AC_DEFUN([gl_REGEX], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT[ - #if HAVE_LOCALE_H - #include - #endif + #include #include #include ]], @@ -47,31 +43,29 @@ AC_DEFUN([gl_REGEX], const char *s; struct re_registers regs; - #if HAVE_LOCALE_H - /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html - This test needs valgrind to catch the bug on Debian - GNU/Linux 3.1 x86, but it might catch the bug better - on other platforms and it shouldn't hurt to try the - test here. */ - if (setlocale (LC_ALL, "en_US.UTF-8")) - { - static char const pat[] = "insert into"; - static char const data[] = - "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; - re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE - | RE_ICASE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern (pat, sizeof pat - 1, ®ex); - if (s) - result |= 1; - else if (re_search (®ex, data, sizeof data - 1, - 0, sizeof data - 1, ®s) - != -1) - result |= 1; - if (! setlocale (LC_ALL, "C")) - return 1; - } - #endif + /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html + This test needs valgrind to catch the bug on Debian + GNU/Linux 3.1 x86, but it might catch the bug better + on other platforms and it shouldn't hurt to try the + test here. */ + if (setlocale (LC_ALL, "en_US.UTF-8")) + { + static char const pat[] = "insert into"; + static char const data[] = + "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; + re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE + | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern (pat, sizeof pat - 1, ®ex); + if (s) + result |= 1; + else if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + result |= 1; + if (! setlocale (LC_ALL, "C")) + return 1; + } /* This test is from glibc bug 3957, reported by Andrew Mackey. */ re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 52edf718fd..77eb125710 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SIGNAL_H], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([signal.h]) + gl_NEXT_HEADERS([signal.h]) # AIX declares sig_atomic_t to already include volatile, and C89 compilers # then choke on 'volatile sig_atomic_t'. C99 requires that it compile. AC_CHECK_TYPE([volatile sig_atomic_t], [], diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 945a93abd7..b6163d6806 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -9,7 +9,7 @@ AC_DEFUN([gl_STDIO_H], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) - gl_CHECK_NEXT_HEADERS([stdio.h]) + gl_NEXT_HEADERS([stdio.h]) dnl No need to create extra modules for these functions. Everyone who uses dnl likely needs them. GNULIB_FPRINTF=1 diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index e7ed4a952e..a71468f13c 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 33 +# stdlib_h.m4 serial 34 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([stdlib.h]) + gl_NEXT_HEADERS([stdlib.h]) AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) if test $ac_cv_header_random_h = yes; then HAVE_RANDOM_H=1 diff --git a/m4/string_h.m4 b/m4/string_h.m4 index bde607fb3f..30ddfbc3a4 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 18 +# serial 19 # Written by Paul Eggert. @@ -20,7 +20,7 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([string.h]) + gl_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not diff --git a/m4/time_h.m4 b/m4/time_h.m4 index dc601c574a..615da1cfd3 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. -# serial 3 +# serial 4 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -21,7 +21,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([time.h]) + gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) ]) diff --git a/tests/test-argp.c b/tests/test-argp.c index 7da426f066..f0b864d81d 100644 --- a/tests/test-argp.c +++ b/tests/test-argp.c @@ -21,9 +21,7 @@ #include #include -#if HAVE_STRING_H -# include -#endif +#include #if HAVE_STRINGS_H # include #endif -- cgit v1.2.1