bug-gnulib
[Top][All Lists]
Advanced

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

Re: [6/7] Proposed patches to remove several inttypes-related dependenci


From: Bruno Haible
Subject: Re: [6/7] Proposed patches to remove several inttypes-related dependencies
Date: Sun, 24 Apr 2011 16:53:50 +0200
User-agent: KMail/1.9.9

Hi Paul,

> Responsibility for declaring imaxabs in
> <inttypes.h> has been moved to the imaxabs module, and similarly for
> imaxdiv, strtoimax, strtoumax.  Also, <inttypes.h> no longer defines
> the PRI* and SCN* macros correctly unless the new module
> inttypes-pri-scn is used.

These are 6 independent, separate changes. It is impossible for me to review
a 600-lines patch that mixes 6 different topics, overlapping in the same files.

Regarding imaxabs and imaxdiv, I certainly agree that the configure check
whether the functions are declared can be moved from inttypes.m4 to
{imaxabs.m4,imaxdiv.m4}. This is not even a backward-incompatible change,
because the corresponding declarations in inttypes.in.h are guarded with
#if @GNULIB_IMAXABS@ or #if @GNULIB_IMAXDIV@, respectively. Also no
reasonable program will rely on the declaration of a function without also
relying on its definition - and the definition is provided by the modules
'imaxabs', 'imaxdiv', respectively.

I'm applying the three patches below, extracted from your input.

Regarding strtoimax and strtoumax: As I said I cannot review this. But it
looks fishy that you remove the corresponding code from inttypes.m4 but
don't add it in m4/strtoimax.m4 and m4/strtoumax.m4. It looks like patches
[1/7] and [2/7] introduced duplicated code and [6/7] removes it? When
actually a self-contained commit would add the code on one side and remove
it on the other side, atomically.


2011-04-22  Paul Eggert  <address@hidden>

        inttypes: Remove configure tests that are not needed since 2009-12-31.
        * m4/inttypes.m4 (gl_INTTYPES_H): Remove determination of
        gl_cv_header_working_inttypes_h.

--- m4/inttypes.m4.orig Sun Apr 24 16:12:53 2011
+++ m4/inttypes.m4      Sun Apr 24 16:12:35 2011
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 18
+# inttypes.m4 serial 19
 dnl Copyright (C) 2006-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,
@@ -17,125 +17,6 @@
   AC_CHECK_DECLS_ONCE([strtoimax])
   AC_CHECK_DECLS_ONCE([strtoumax])
 
-  dnl Now see if we need a substitute <inttypes.h>.
-  dnl A complete <inttypes.h> requires
-  dnl   - a complete <stdint.h>,
-  dnl   - the existence of an <inttypes.h>,
-  dnl   - that imaxabs, imaxdiv, strtoimax, strtoumax are declared,
-  dnl   - some additional tests.
-  AC_CACHE_CHECK([whether inttypes.h conforms to C99],
-    [gl_cv_header_working_inttypes_h],
-    [gl_cv_header_working_inttypes_h=no
-     if test "$gl_cv_header_working_stdint_h" = yes \
-        && test $ac_cv_header_inttypes_h = yes \
-        && test "$ac_cv_have_decl_imaxabs" = yes \
-        && test "$ac_cv_have_decl_imaxdiv" = yes \
-        && test "$ac_cv_have_decl_strtoimax" = yes \
-        && test "$ac_cv_have_decl_strtoumax" = yes; then
-       AC_COMPILE_IFELSE([
-         AC_LANG_PROGRAM([[
-#include <stddef.h>
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */
-#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */
-#include <inttypes.h>
-
-/* No need to duplicate the tests of stdint.m4; they are subsumed by
-   $gl_cv_header_working_stdint_h = yes.  */
-
-/* Tests for macros supposed to be defined in inttypes.h.  */
-
-const char *k = /* implicit string concatenation */
-#ifdef INT8_MAX
-  PRId8 PRIi8
-#endif
-#ifdef UINT8_MAX
-  PRIo8 PRIu8 PRIx8 PRIX8
-#endif
-#ifdef INT16_MAX
-  PRId16 PRIi16
-#endif
-#ifdef UINT16_MAX
-  PRIo16 PRIu16 PRIx16 PRIX16
-#endif
-#ifdef INT32_MAX
-  PRId32 PRIi32
-#endif
-#ifdef UINT32_MAX
-  PRIo32 PRIu32 PRIx32 PRIX32
-#endif
-#ifdef INT64_MAX
-  PRId64 PRIi64
-#endif
-#ifdef UINT64_MAX
-  PRIo64 PRIu64 PRIx64 PRIX64
-#endif
-  PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8
-  PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16
-  PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32
-  PRIdLEAST64 PRIiLEAST64
-  PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64
-  PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8
-  PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16
-  PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32
-  PRIdFAST64 PRIiFAST64
-  PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64
-  PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX
-#ifdef INTPTR_MAX
-  PRIdPTR PRIiPTR
-#endif
-#ifdef UINTPTR_MAX
-  PRIoPTR PRIuPTR PRIxPTR PRIXPTR
-#endif
-  ;
-const char *l = /* implicit string concatenation */
-#ifdef INT8_MAX
-  SCNd8 SCNi8
-#endif
-#ifdef UINT8_MAX
-  SCNo8 SCNu8 SCNx8
-#endif
-#ifdef INT16_MAX
-  SCNd16 SCNi16
-#endif
-#ifdef UINT16_MAX
-  SCNo16 SCNu16 SCNx16
-#endif
-#ifdef INT32_MAX
-  SCNd32 SCNi32
-#endif
-#ifdef UINT32_MAX
-  SCNo32 SCNu32 SCNx32
-#endif
-#ifdef INT64_MAX
-  SCNd64 SCNi64
-#endif
-#ifdef UINT64_MAX
-  SCNo64 SCNu64 SCNx64
-#endif
-  SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8
-  SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16
-  SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32
-  SCNdLEAST64 SCNiLEAST64
-  SCNoLEAST64 SCNuLEAST64 SCNxLEAST64
-  SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8
-  SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16
-  SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32
-  SCNdFAST64 SCNiFAST64
-  SCNoFAST64 SCNuFAST64 SCNxFAST64
-  SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX
-#ifdef INTPTR_MAX
-  SCNdPTR SCNiPTR
-#endif
-#ifdef UINTPTR_MAX
-  SCNoPTR SCNuPTR SCNxPTR
-#endif
-  ;
-         ]])],
-         [gl_cv_header_working_inttypes_h=yes])
-     fi])
-
   dnl Override <inttypes.h> always, so that the portability warnings work.
   AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([inttypes.h])


2011-04-22  Paul Eggert  <address@hidden>

        inttypes: Move some configure check to module 'imaxabs'.
        * m4/imaxabs.m4 (gl_FUNC_IMAXABS): Require gl_INTTYPES_H_DEFAULTS
        instead of gl_INTTYPES_H.  Check for imaxabs decl here.
        * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxabs decl here.

--- m4/imaxabs.m4.orig  Sun Apr 24 16:43:45 2011
+++ m4/imaxabs.m4       Sun Apr 24 16:43:22 2011
@@ -1,4 +1,4 @@
-# imaxabs.m4 serial 1
+# imaxabs.m4 serial 2
 dnl Copyright (C) 2006, 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,
@@ -6,8 +6,10 @@
 
 AC_DEFUN([gl_FUNC_IMAXABS],
 [
-  AC_REQUIRE([gl_INTTYPES_H])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([imaxabs])
   if test "$ac_cv_have_decl_imaxabs" != yes; then
+    HAVE_DECL_IMAXABS=0
     AC_LIBOBJ([imaxabs])
     gl_PREREQ_IMAXABS
   fi
--- m4/inttypes.m4.orig Sun Apr 24 16:43:45 2011
+++ m4/inttypes.m4      Sun Apr 24 16:43:30 2011
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 19
+# inttypes.m4 serial 20
 dnl Copyright (C) 2006-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,
@@ -12,7 +12,6 @@
   AC_REQUIRE([gl_STDINT_H])
   AC_REQUIRE([gt_INTTYPES_PRI])
   AC_CHECK_HEADERS_ONCE([inttypes.h])
-  AC_CHECK_DECLS_ONCE([imaxabs])
   AC_CHECK_DECLS_ONCE([imaxdiv])
   AC_CHECK_DECLS_ONCE([strtoimax])
   AC_CHECK_DECLS_ONCE([strtoumax])
@@ -62,12 +61,6 @@
   fi
   AC_SUBST([PRIPTR_PREFIX])
 
-  if test "$ac_cv_have_decl_imaxabs" = yes; then
-    HAVE_DECL_IMAXABS=1
-  else
-    HAVE_DECL_IMAXABS=0
-  fi
-
   if test "$ac_cv_have_decl_imaxdiv" = yes; then
     HAVE_DECL_IMAXDIV=1
   else


2011-04-22  Paul Eggert  <address@hidden>

        inttypes: Move some configure check to module 'imaxdiv'.
        * m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Require gl_INTTYPES_H_DEFAULTS
        instead of gl_INTTYPES_H.  Check for imaxdiv decl here.
        * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxdiv decl here.

--- m4/imaxdiv.m4.orig  Sun Apr 24 16:51:25 2011
+++ m4/imaxdiv.m4       Sun Apr 24 16:51:14 2011
@@ -1,4 +1,4 @@
-# imaxdiv.m4 serial 1
+# imaxdiv.m4 serial 2
 dnl Copyright (C) 2006, 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,
@@ -6,8 +6,10 @@
 
 AC_DEFUN([gl_FUNC_IMAXDIV],
 [
-  AC_REQUIRE([gl_INTTYPES_H])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([imaxdiv])
   if test "$ac_cv_have_decl_imaxdiv" != yes; then
+    HAVE_DECL_IMAXDIV=0
     AC_LIBOBJ([imaxdiv])
     gl_PREREQ_IMAXDIV
   fi
--- m4/inttypes.m4.orig Sun Apr 24 16:51:25 2011
+++ m4/inttypes.m4      Sun Apr 24 16:51:20 2011
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 20
+# inttypes.m4 serial 21
 dnl Copyright (C) 2006-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,
@@ -12,7 +12,6 @@
   AC_REQUIRE([gl_STDINT_H])
   AC_REQUIRE([gt_INTTYPES_PRI])
   AC_CHECK_HEADERS_ONCE([inttypes.h])
-  AC_CHECK_DECLS_ONCE([imaxdiv])
   AC_CHECK_DECLS_ONCE([strtoimax])
   AC_CHECK_DECLS_ONCE([strtoumax])
 
@@ -61,12 +60,6 @@
   fi
   AC_SUBST([PRIPTR_PREFIX])
 
-  if test "$ac_cv_have_decl_imaxdiv" = yes; then
-    HAVE_DECL_IMAXDIV=1
-  else
-    HAVE_DECL_IMAXDIV=0
-  fi
-
   if test "$ac_cv_have_decl_strtoimax" = yes; then
     HAVE_DECL_STRTOIMAX=1
   else



-- 
In memoriam Siamanto <http://en.wikipedia.org/wiki/Siamanto>



reply via email to

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