bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 3/4] inttypes-incomplete: new module


From: Paul Eggert
Subject: [PATCH 3/4] inttypes-incomplete: new module
Date: Mon, 25 Apr 2011 22:00:32 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8

* m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing
all but the PRI* and SCN* parts of gl_INTTYPES_H.
(gl_INTTYPES_PRI_SCN): New macro, containing the PRI* and SCN* parts
of gl_INTTYPES_H.
(gl_INTTYPES_H): Rewrite in terms of these new macros.
(gl_INTTYPES_H_DEFAULTS): Provide defaults for the PRI* and SCN*
parts, in case gl_INTTYPE_PRI_SCN is not invoked.
* modules/imaxabs, modules/imaxdiv, modules/strtoimax (Depends-on):
* modules/strtoumax, modules/xstrtol (Depends-on):
Depend on inttypes-incomplete, not inttypes.
* modules/inttypes-incomplete: New module, containing the contents
of the old modules/inttypes module, except that the Files: section
omits m4/inttypes-pri.m4, and the configure.ac section invokes
gl_INTTYPES_INCOMPLETE rather than gl_INTTYPES_H.
* modules/inttypes (Files): Remove lib/inttypes.in.h, m4/inttypes.m4.
(Depends-on): Depend only on inttypes-incomplete.
(Makefile.am): Remove everything; this is now in inttypes-incomplete.
---
 ChangeLog                   |   19 +++++++++++++
 m4/inttypes.m4              |   29 +++++++++++++++-----
 modules/imaxabs             |    2 +-
 modules/imaxdiv             |    2 +-
 modules/inttypes            |   43 +-----------------------------
 modules/inttypes-incomplete |   62 +++++++++++++++++++++++++++++++++++++++++++
 modules/strtoimax           |    2 +-
 modules/strtoumax           |    2 +-
 modules/xstrtol             |    2 +-
 9 files changed, 109 insertions(+), 54 deletions(-)
 create mode 100644 modules/inttypes-incomplete

diff --git a/ChangeLog b/ChangeLog
index d37667b..4fef3ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2011-04-25  Paul Eggert  <address@hidden>
 
+       inttypes-incomplete: new module
+       * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing
+       all but the PRI* and SCN* parts of gl_INTTYPES_H.
+       (gl_INTTYPES_PRI_SCN): New macro, containing the PRI* and SCN* parts
+       of gl_INTTYPES_H.
+       (gl_INTTYPES_H): Rewrite in terms of these new macros.
+       (gl_INTTYPES_H_DEFAULTS): Provide defaults for the PRI* and SCN*
+       parts, in case gl_INTTYPE_PRI_SCN is not invoked.
+       * modules/imaxabs, modules/imaxdiv, modules/strtoimax (Depends-on):
+       * modules/strtoumax, modules/xstrtol (Depends-on):
+       Depend on inttypes-incomplete, not inttypes.
+       * modules/inttypes-incomplete: New module, containing the contents
+       of the old modules/inttypes module, except that the Files: section
+       omits m4/inttypes-pri.m4, and the configure.ac section invokes
+       gl_INTTYPES_INCOMPLETE rather than gl_INTTYPES_H.
+       * modules/inttypes (Files): Remove lib/inttypes.in.h, m4/inttypes.m4.
+       (Depends-on): Depend only on inttypes-incomplete.
+       (Makefile.am): Remove everything; this is now in inttypes-incomplete.
+
        inttypes: omit now-redundant strtoimax and strtoumax work
        * m4/inttypes.m4 (gl_INTTYPES_H): Do not check for strtoimax and
        strtoumax decls; gl_FUNC_STRTOIMAX and gl_FUNC_STRTOUMAX now do this.
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index 99a6071..ee5bc1c 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 22
+# inttypes.m4 serial 23
 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,
@@ -9,8 +9,13 @@ dnl Test whether <inttypes.h> is supported or must be 
substituted.
 
 AC_DEFUN([gl_INTTYPES_H],
 [
+  AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
+  gl_INTTYPES_PRI_SCN
+])
+
+AC_DEFUN([gl_INTTYPES_INCOMPLETE],
+[
   AC_REQUIRE([gl_STDINT_H])
-  AC_REQUIRE([gt_INTTYPES_PRI])
   AC_CHECK_HEADERS_ONCE([inttypes.h])
 
   dnl Override <inttypes.h> always, so that the portability warnings work.
@@ -35,6 +40,17 @@ AC_DEFUN([gl_INTTYPES_H],
 #endif
 ])
 
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
+    ]], [imaxabs imaxdiv strtoimax strtoumax])
+])
+
+# Ensure that the PRI* and SCN* macros are defined appropriately.
+AC_DEFUN([gl_INTTYPES_PRI_SCN],
+[
+  AC_REQUIRE([gt_INTTYPES_PRI])
+
   PRIPTR_PREFIX=
   if test -n "$STDINT_H"; then
     dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
@@ -86,11 +102,6 @@ AC_DEFUN([gl_INTTYPES_H],
   else
     UINT64_MAX_EQ_ULONG_MAX=-1
   fi
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
-    ]], [imaxabs imaxdiv strtoimax strtoumax])
 ])
 
 # Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
@@ -152,4 +163,8 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
   HAVE_DECL_IMAXDIV=1;   AC_SUBST([HAVE_DECL_IMAXDIV])
   HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
   HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
+  INT64_MAX_EQ_LONG_MAX='defined _LP64';  AC_SUBST([INT64_MAX_EQ_LONG_MAX])
+  PRI_MACROS_BROKEN=0;   AC_SUBST([PRI_MACROS_BROKEN])
+  PRIPTR_PREFIX=__PRIPTR_PREFIX;  AC_SUBST([PRIPTR_PREFIX])
+  UINT64_MAX_EQ_ULONG_MAX='defined _LP64';  AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])
 ])
diff --git a/modules/imaxabs b/modules/imaxabs
index 481486d..8da390f 100644
--- a/modules/imaxabs
+++ b/modules/imaxabs
@@ -6,7 +6,7 @@ lib/imaxabs.c
 m4/imaxabs.m4
 
 Depends-on:
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_FUNC_IMAXABS
diff --git a/modules/imaxdiv b/modules/imaxdiv
index 7eacbc7..7589024 100644
--- a/modules/imaxdiv
+++ b/modules/imaxdiv
@@ -6,7 +6,7 @@ lib/imaxdiv.c
 m4/imaxdiv.m4
 
 Depends-on:
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_FUNC_IMAXDIV
diff --git a/modules/inttypes b/modules/inttypes
index f85939c..157b597 100644
--- a/modules/inttypes
+++ b/modules/inttypes
@@ -2,56 +2,15 @@ Description:
 An <inttypes.h> that nearly conforms to C99.
 
 Files:
-lib/inttypes.in.h
 m4/inttypes-pri.m4
-m4/inttypes.m4
 
 Depends-on:
-arg-nonnull
-include_next
-multiarch
-stdint
-warn-on-use
+inttypes-incomplete
 
 configure.ac:
 gl_INTTYPES_H
 
 Makefile.am:
-BUILT_SOURCES += inttypes.h
-
-# We need the following in order to create <inttypes.h> when the system
-# doesn't have one that works with the given compiler.
-inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) 
$(ARG_NONNULL_H)
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-             -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
-             -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
-             -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
-             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
-             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
-             -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
-             -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
-             -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
-             -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
-             -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
-             -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
-             -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
-             -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
-             -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-             -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' 
\
-             -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
-             -e 
's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
-             -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' 
\
-             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/inttypes.in.h; \
-       } > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += inttypes.h inttypes.h-t
 
 Include:
 <inttypes.h>
diff --git a/modules/inttypes-incomplete b/modules/inttypes-incomplete
new file mode 100644
index 0000000..ef743dd
--- /dev/null
+++ b/modules/inttypes-incomplete
@@ -0,0 +1,62 @@
+Description:
+An <inttypes.h> that conforms to C99 except for PRI* and SCN* macros.
+
+Files:
+lib/inttypes.in.h
+m4/inttypes.m4
+
+Depends-on:
+arg-nonnull
+include_next
+multiarch
+stdint
+warn-on-use
+
+configure.ac:
+gl_INTTYPES_INCOMPLETE
+
+Makefile.am:
+BUILT_SOURCES += inttypes.h
+
+# We need the following in order to create <inttypes.h> when the system
+# doesn't have one that works with the given compiler.
+inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) 
$(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
+             -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
+             -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
+             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
+             -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
+             -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
+             -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
+             -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
+             -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
+             -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
+             -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
+             -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
+             -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
+             -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' 
\
+             -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
+             -e 
's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
+             -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' 
\
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/inttypes.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += inttypes.h inttypes.h-t
+
+Include:
+<inttypes.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/strtoimax b/modules/strtoimax
index 9f82af4..c4e8982 100644
--- a/modules/strtoimax
+++ b/modules/strtoimax
@@ -9,7 +9,7 @@ m4/strtoimax.m4
 Depends-on:
 strtoll
 verify
-inttypes
+inttypes-incomplete
 stdint
 
 configure.ac:
diff --git a/modules/strtoumax b/modules/strtoumax
index e886285..a1a84f5 100644
--- a/modules/strtoumax
+++ b/modules/strtoumax
@@ -9,7 +9,7 @@ m4/strtoumax.m4
 Depends-on:
 strtoimax
 strtoull
-inttypes
+inttypes-incomplete
 stdint
 
 configure.ac:
diff --git a/modules/xstrtol b/modules/xstrtol
index 3ce76a8..b48a4bb 100644
--- a/modules/xstrtol
+++ b/modules/xstrtol
@@ -14,7 +14,7 @@ error
 getopt-gnu
 gettext-h
 intprops
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_XSTRTOL
-- 
1.7.4.4





reply via email to

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