From 051f3f4e306c6f6ede3da2729ef666fd3edb3d68 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 Jan 2012 18:42:08 +0100 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ lib/inttypes.in.h | 12 ++++++++++-- modules/inttypes-incomplete | 4 +++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23b1e871a..980059a97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-01-05 Bruno Haible + + 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 init.sh: don't waste a subshell just to redirect stderr diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index e08a6608c..e10f69767 100644 --- 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 ." #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 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " #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 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " #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 diff --git a/modules/inttypes-incomplete b/modules/inttypes-incomplete index d9d53ac87..14beccb3c 100644 --- a/modules/inttypes-incomplete +++ b/modules/inttypes-incomplete @@ -9,6 +9,7 @@ Depends-on: include_next multiarch snippet/arg-nonnull +snippet/c++defs snippet/warn-on-use stdint @@ -20,7 +21,7 @@ BUILT_SOURCES += inttypes.h # We need the following in order to create 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 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_N -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; \ -- 2.11.0