changeset 16229:daac1ca4c436

inttypes: Modernize. * lib/inttypes.in.h (strtoimax, strtoumax): Use the C++ safe idioms. * modules/inttypes-incomplete (Depends-on): Add snippet/c++defs. (Makefile.am): Update inttypes.h rule.
author Bruno Haible <bruno@clisp.org>
date Thu, 05 Jan 2012 18:42:08 +0100
parents 4adb73653ffa
children f9e137049132
files ChangeLog lib/inttypes.in.h modules/inttypes-incomplete
diffstat 3 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-05  Bruno Haible  <bruno@clisp.org>
+
+	inttypes: Modernize.
+	* lib/inttypes.in.h (strtoimax, strtoumax): Use the C++ safe idioms.
+	* modules/inttypes-incomplete (Depends-on): Add snippet/c++defs.
+	(Makefile.am): Update inttypes.h rule.
+
 2012-01-05  Jim Meyering  <meyering@redhat.com>
 
 	init.sh: don't waste a subshell just to redirect stderr
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -56,6 +56,8 @@
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 #endif
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
@@ -1079,8 +1081,11 @@
 #if @GNULIB_STRTOIMAX@
 # if !@HAVE_DECL_STRTOIMAX@
 #  undef strtoimax
-extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (strtoimax, intmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int));
+_GL_CXXALIASWARN (strtoimax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
 # if HAVE_RAW_DECL_STRTOIMAX
@@ -1092,8 +1097,11 @@
 #if @GNULIB_STRTOUMAX@
 # if !@HAVE_DECL_STRTOUMAX@
 #  undef strtoumax
-extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+_GL_CXXALIASWARN (strtoumax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
 # if HAVE_RAW_DECL_STRTOUMAX
--- a/modules/inttypes-incomplete
+++ b/modules/inttypes-incomplete
@@ -9,6 +9,7 @@
 include_next
 multiarch
 snippet/arg-nonnull
+snippet/c++defs
 snippet/warn-on-use
 stdint
 
@@ -20,7 +21,7 @@
 
 # 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)
+inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -45,6 +46,7 @@
 	      -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 '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
 	      -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; \