bug-gnulib
[Top][All Lists]
Advanced

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

Re: AC_HEADER_STDC


From: Paul Eggert
Subject: Re: AC_HEADER_STDC
Date: Thu, 06 Jul 2006 14:54:32 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

I found a few other glitches related to the AC_HEADER_STDC changes
while propagating them into coreutils, and installed the following
further patches.  Some of the problems predate the recent changes.
For example, the code wasn't portable to (theoretical?) C99
implementations that have an isblank function but not an isblank
macro.

2006-07-06  Paul Eggert  <address@hidden>

        * lib/fnmatch.c (ISBLANK): Remove.  All uses changed to isblank.
        (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro.
        (ISGRAPH): Remove.  All uses changed to isgraph.
        (FOLD) [!defined _LIBC]: Remove special case.
        * lib/getdate.y (lookup_word): Remove no-longer-needed call to islower.
        * lib/regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not
        HAVE_ISBLANK.
        * lib/strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special 
case.

        * m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Don't check for getenv decl;
        no longer needed.  Check for isblank decl.
        * m4/mkstemp.m4 (gl_PREREQ_TEMPNAME): Don't check for getenv decl.
        * m4/regex.m4 (gl_PREREQ_REGEX): Dheck for isblank decl instead
        of existence.

Index: lib/backupfile.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/backupfile.c,v
retrieving revision 1.48
diff -p -u -r1.48 backupfile.c
--- lib/backupfile.c    3 Jul 2006 08:32:46 -0000       1.48
+++ lib/backupfile.c    6 Jul 2006 21:44:35 -0000
@@ -95,11 +95,11 @@
 #endif
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   ISDIGIT unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
Index: lib/fnmatch.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch.c,v
retrieving revision 1.34
diff -p -u -r1.34 fnmatch.c
--- lib/fnmatch.c       5 Jul 2006 23:35:19 -0000       1.34
+++ lib/fnmatch.c       6 Jul 2006 21:44:35 -0000
@@ -86,15 +86,8 @@ extern int fnmatch (const char *pattern,
 #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
 
 
-# ifdef isblank
-#  define ISBLANK(c) isblank (c)
-# else
-#  define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-# endif
-# ifdef isgraph
-#  define ISGRAPH(c) isgraph (c)
-# else
-#  define ISGRAPH(c) (isprint (c) && !isspace (c))
+# if ! (defined isblank || HAVE_DECL_ISBLANK)
+#  define isblank(c) ((c) == ' ' || (c) == '\t')
 # endif
 
 # define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
@@ -152,11 +145,7 @@ static int posixly_correct;
 # endif
 
 /* Note that this evaluates C many times.  */
-# ifdef _LIBC
-#  define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
-# else
-#  define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
-# endif
+# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
 # define CHAR  char
 # define UCHAR unsigned char
 # define INT   int
Index: lib/fnmatch_loop.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch_loop.c,v
retrieving revision 1.12
diff -p -u -r1.12 fnmatch_loop.c
--- lib/fnmatch_loop.c  5 Jul 2006 23:35:19 -0000       1.12
+++ lib/fnmatch_loop.c  6 Jul 2006 21:44:35 -0000
@@ -290,10 +290,10 @@ FCT (const CHAR *pattern, const CHAR *st
 #else
                    if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n))
                        || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n))
-                       || (STREQ (str, L_("blank")) && ISBLANK ((UCHAR) *n))
+                       || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n))
                        || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n))
                        || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n))
-                       || (STREQ (str, L_("graph")) && ISGRAPH ((UCHAR) *n))
+                       || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n))
                        || (STREQ (str, L_("lower")) && islower ((UCHAR) *n))
                        || (STREQ (str, L_("print")) && isprint ((UCHAR) *n))
                        || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n))
Index: lib/getdate.y
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getdate.y,v
retrieving revision 1.104
diff -p -u -r1.104 getdate.y
--- lib/getdate.y       5 Jul 2006 23:35:19 -0000       1.104
+++ lib/getdate.y       6 Jul 2006 21:44:35 -0000
@@ -70,8 +70,8 @@
 
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    isdigit unless it's important to use the locale's definition
@@ -887,8 +887,7 @@ lookup_word (parser_control const *pc, c
   for (p = word; *p; p++)
     {
       unsigned char ch = *p;
-      if (islower (ch))
-       *p = toupper (ch);
+      *p = toupper (ch);
     }
 
   for (tp = meridian_table; tp->name; tp++)
Index: lib/posixtm.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/posixtm.c,v
retrieving revision 1.22
diff -p -u -r1.22 posixtm.c
--- lib/posixtm.c       9 Jan 2006 23:13:56 -0000       1.22
+++ lib/posixtm.c       6 Jul 2006 21:44:35 -0000
@@ -44,11 +44,11 @@
 #endif
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   isdigit unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
Index: lib/regex_internal.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/regex_internal.h,v
retrieving revision 1.21
diff -p -u -r1.21 regex_internal.h
--- lib/regex_internal.h        10 Apr 2006 06:43:33 -0000      1.21
+++ lib/regex_internal.h        6 Jul 2006 21:44:35 -0000
@@ -56,7 +56,7 @@
 #endif
 
 /* In case that the system doesn't have isblank().  */
-#if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank
+#if !defined _LIBC && !HAVE_DECL_ISBLANK && !defined isblank
 # define isblank(ch) ((ch) == ' ' || (ch) == '\t')
 #endif
 
Index: lib/sig2str.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/sig2str.c,v
retrieving revision 1.7
diff -p -u -r1.7 sig2str.c
--- lib/sig2str.c       19 Sep 2005 17:28:15 -0000      1.7
+++ lib/sig2str.c       6 Jul 2006 21:44:35 -0000
@@ -247,11 +247,11 @@ static struct numname { int num; char co
 #define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0])
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   isdigit unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
Index: lib/strftime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strftime.c,v
retrieving revision 1.88
diff -p -u -r1.88 strftime.c
--- lib/strftime.c      29 Jun 2006 21:11:49 -0000      1.88
+++ lib/strftime.c      6 Jul 2006 21:44:35 -0000
@@ -278,17 +278,12 @@ extern char *tzname[];
 #  define TOLOWER(Ch, L) towlower (Ch)
 # endif
 #else
-# ifdef _LIBC
-#  ifdef USE_IN_EXTENDED_LOCALE_MODEL
-#   define TOUPPER(Ch, L) __toupper_l (Ch, L)
-#   define TOLOWER(Ch, L) __tolower_l (Ch, L)
-#  else
-#   define TOUPPER(Ch, L) toupper (Ch)
-#   define TOLOWER(Ch, L) tolower (Ch)
-#  endif
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define TOUPPER(Ch, L) __toupper_l (Ch, L)
+#  define TOLOWER(Ch, L) __tolower_l (Ch, L)
 # else
-#  define TOUPPER(Ch, L) (islower (Ch) ? toupper (Ch) : (Ch))
-#  define TOLOWER(Ch, L) (isupper (Ch) ? tolower (Ch) : (Ch))
+#  define TOUPPER(Ch, L) toupper (Ch)
+#  define TOLOWER(Ch, L) tolower (Ch)
 # endif
 #endif
 /* We don't use `isdigit' here since the locale dependent
Index: lib/strverscmp.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strverscmp.c,v
retrieving revision 1.17
diff -p -u -r1.17 strverscmp.c
--- lib/strverscmp.c    19 Sep 2005 17:28:15 -0000      1.17
+++ lib/strverscmp.c    6 Jul 2006 21:44:35 -0000
@@ -37,11 +37,11 @@
 
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   isdigit unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
Index: lib/userspec.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/userspec.c,v
retrieving revision 1.50
diff -p -u -r1.50 userspec.c
--- lib/userspec.c      23 Sep 2005 04:15:13 -0000      1.50
+++ lib/userspec.c      6 Jul 2006 21:44:36 -0000
@@ -76,11 +76,11 @@
 #endif
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   isdigit unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
Index: m4/fnmatch.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/fnmatch.m4,v
retrieving revision 1.22
diff -p -u -r1.22 fnmatch.m4
--- m4/fnmatch.m4       28 Jun 2006 22:00:55 -0000      1.22
+++ m4/fnmatch.m4       6 Jul 2006 21:44:36 -0000
@@ -63,7 +63,7 @@ AS_IF([test $$2 = yes], [$3], [$4])
 AC_DEFUN([_AC_LIBOBJ_FNMATCH],
 [AC_REQUIRE([AC_FUNC_ALLOCA])dnl
 AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
-AC_CHECK_DECLS([getenv])
+AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
 AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy])
 AC_CHECK_HEADERS([wchar.h wctype.h])
 AC_LIBOBJ([fnmatch])
Index: m4/mkstemp.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/mkstemp.m4,v
retrieving revision 1.16
diff -p -u -r1.16 mkstemp.m4
--- m4/mkstemp.m4       23 Sep 2005 04:15:13 -0000      1.16
+++ m4/mkstemp.m4       6 Jul 2006 21:44:36 -0000
@@ -1,6 +1,6 @@
-#serial 12
+#serial 13
 
-# Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -67,6 +67,5 @@ AC_DEFUN([gl_PREREQ_TEMPNAME],
 [
   AC_CHECK_HEADERS_ONCE(sys/time.h)
   AC_CHECK_FUNCS(__secure_getenv gettimeofday)
-  AC_CHECK_DECLS_ONCE(getenv)
   AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
 ])
Index: m4/regex.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/regex.m4,v
retrieving revision 1.52
diff -p -u -r1.52 regex.m4
--- m4/regex.m4 10 Apr 2006 06:43:33 -0000      1.52
+++ m4/regex.m4 6 Jul 2006 21:44:36 -0000
@@ -166,5 +166,6 @@ AC_DEFUN([gl_PREREQ_REGEX],
   AC_REQUIRE([gl_C_RESTRICT])
   AC_REQUIRE([AM_LANGINFO_CODESET])
   AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h])
-  AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll])
+  AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll])
+  AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
 ])




reply via email to

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