diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-11-19 16:00:57 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-11-19 16:01:32 -0800 |
commit | bbd84f86bce9c04ae08d9bccbad19c48e74f3f8b (patch) | |
tree | 19d511f0e9094149fc61dfe19af992bff0cb03d8 /build-aux | |
parent | 493a8f33ba916403d1fab620e08146632b826101 (diff) | |
download | emacs-bbd84f86bce9c04ae08d9bccbad19c48e74f3f8b.tar.gz |
Merge from gnulib
This incorporates:
2016-11-15 sys_time: add gnulib::timeval for C++
2016-11-14 snippet/c++defs: fix real-floating arg functions in C++ mode
2016-11-13 strftime: don't use __THROW
2016-11-12 strftime: tune %q
2016-11-12 Merge strftime.c changes from glibc
2016-11-09 manywarnings: fix -Wno-missing-field-initializers detection
2016-11-05 strftime,strptime: support %q to represent the quarter
The glibc changes in turn incorporate the following strftime.c changes:
2015-10-20 Convert misc function definitions to prototype style
2015-09-26 [BZ #18985] out of range data to strftime() causes segfault
2010-01-09 Add support for XPG7 testing
2009-10-30 Implement Burmese language locale for Myanmar
2008-06-13 [BZ #6612] pass reference to tzset_called around
2007-10-16 [BZ #5184] Add tzset_called argument
* build-aux/snippet/c++defs.h, lib/strftime.c, lib/sys_time.in.h:
* m4/manywarnings.m4: Copy from gnulib.
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/snippet/c++defs.h | 75 |
1 files changed, 55 insertions, 20 deletions
diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h index 813f2e2e4e8..d42ea25d852 100644 --- a/build-aux/snippet/c++defs.h +++ b/build-aux/snippet/c++defs.h @@ -17,6 +17,15 @@ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some @@ -111,14 +120,22 @@ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); - */ + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - rettype (*const func) parameters = ::rpl_func; \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + inline type rpl () const { return ::rpl_func; } \ + inline operator type () const { return rpl (); } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -135,8 +152,13 @@ # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - rettype (*const func) parameters = \ - reinterpret_cast<rettype(*)parameters>(::rpl_func); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + inline type rpl () const \ + { return reinterpret_cast<type>(::rpl_func); } \ + inline operator type () const { return rpl (); } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -150,18 +172,20 @@ is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); - */ + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ #if defined __cplusplus && defined GNULIB_NAMESPACE - /* If we were to write - rettype (*const func) parameters = ::func; - like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls - better (remove an indirection through a 'static' pointer variable), - but then the _GL_CXXALIASWARN macro below would cause a warning not only - for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = ::func; \ +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + inline type rpl () const { return ::func; } \ + inline operator type () const { return rpl (); } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -178,8 +202,13 @@ # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - static rettype (*func) parameters = \ - reinterpret_cast<rettype(*)parameters>(::func); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + inline type rpl () const \ + { return reinterpret_cast<type>(::func); } \ + inline operator type () const { return rpl (); }\ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -202,9 +231,15 @@ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ - static rettype (*func) parameters = \ - reinterpret_cast<rettype(*)parameters>( \ - (rettype2(*)parameters2)(::func)); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline type rpl () const \ + { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\ + \ + inline operator type () const { return rpl (); } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else |