summaryrefslogtreecommitdiff
path: root/src/gl
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-05-29 14:34:53 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-05-29 14:41:32 +0200
commitc040ce6dd05b48b971d8dcc8fc8f23957ed15f9c (patch)
tree68128a8b1e355ef36a6abc462d06b2a744845dfd /src/gl
parent33f82322503a9eba8f2d848d2a21398207db4832 (diff)
downloadgnutls-c040ce6dd05b48b971d8dcc8fc8f23957ed15f9c.tar.gz
updated gnulib
Diffstat (limited to 'src/gl')
-rw-r--r--src/gl/error.h14
-rw-r--r--src/gl/fseeko.c2
-rw-r--r--src/gl/m4/extern-inline.m45
-rw-r--r--src/gl/m4/stdio_h.m420
-rw-r--r--src/gl/stddef.in.h19
-rw-r--r--src/gl/string.in.h21
-rw-r--r--src/gl/xalloc.h3
7 files changed, 65 insertions, 19 deletions
diff --git a/src/gl/error.h b/src/gl/error.h
index ccffef5853..eb4fb70175 100644
--- a/src/gl/error.h
+++ b/src/gl/error.h
@@ -31,6 +31,16 @@
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
+/* On mingw, the flavor of printf depends on whether the extensions module
+ * is in use; the check for <stdio.h> determines the witness macro. */
+#ifndef _GL_ATTRIBUTE_SPEC_PRINTF
+# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__
+# else
+# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__
+# endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -40,11 +50,11 @@ extern "C" {
If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */
extern void error (int __status, int __errnum, const char *__format, ...)
- _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
+ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4));
extern void error_at_line (int __status, int __errnum, const char *__fname,
unsigned int __lineno, const char *__format, ...)
- _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6));
+ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6));
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
diff --git a/src/gl/fseeko.c b/src/gl/fseeko.c
index b38badd1a1..1c65d2a848 100644
--- a/src/gl/fseeko.c
+++ b/src/gl/fseeko.c
@@ -128,7 +128,7 @@ fseeko (FILE *fp, off_t offset, int whence)
fp->_offset = pos;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
-# if defined __CYGWIN__
+# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
# else
diff --git a/src/gl/m4/extern-inline.m4 b/src/gl/m4/extern-inline.m4
index e74339a165..72800650e6 100644
--- a/src/gl/m4/extern-inline.m4
+++ b/src/gl/m4/extern-inline.m4
@@ -74,12 +74,13 @@ AC_DEFUN([gl_EXTERN_INLINE],
# define _GL_EXTERN_INLINE static _GL_UNUSED
#endif
-/* In GCC, suppress bogus "no previous prototype for 'FOO'"
+/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
+ suppress bogus "no previous prototype for 'FOO'"
and "no previous declaration for 'FOO'" diagnostics,
when FOO is an inline function in the header; see
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
-#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
# define _GL_INLINE_HEADER_CONST_PRAGMA
# else
diff --git a/src/gl/m4/stdio_h.m4 b/src/gl/m4/stdio_h.m4
index e0c4bde1f8..f60cc2156e 100644
--- a/src/gl/m4/stdio_h.m4
+++ b/src/gl/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 44
+# stdio_h.m4 serial 46
dnl Copyright (C) 2007-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,15 +15,21 @@ AC_DEFUN([gl_STDIO_H],
dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
dnl inttypes.h behave like gnu instead of system; we must give our
dnl printf wrapper the right attribute to match.
- AC_CACHE_CHECK([whether inttypes macros match system or gnu printf],
+ AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros],
[gl_cv_func_printf_attribute_flavor],
- [AC_EGREP_CPP([findme .(ll|j)d. findme],
- [#define __STDC_FORMAT_MACROS 1
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #define __STDC_FORMAT_MACROS 1
#include <stdio.h>
#include <inttypes.h>
- findme PRIdMAX findme
- ], [gl_cv_func_printf_attribute_flavor=gnu],
- [gl_cv_func_printf_attribute_flavor=system])])
+ /* For non-mingw systems, compilation will trivially succeed.
+ For mingw, compilation will succeed for older mingw (system
+ printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */
+ #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+ extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1];
+ #endif
+ ]])], [gl_cv_func_printf_attribute_flavor=system],
+ [gl_cv_func_printf_attribute_flavor=gnu])])
if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1],
[Define to 1 if printf and friends should be labeled with
diff --git a/src/gl/stddef.in.h b/src/gl/stddef.in.h
index 44db24173c..698307bc95 100644
--- a/src/gl/stddef.in.h
+++ b/src/gl/stddef.in.h
@@ -83,12 +83,23 @@
/* Some platforms lack max_align_t. */
#if !@HAVE_MAX_ALIGN_T@
+/* On the x86, the maximum storage alignment of double, long, etc. is 4,
+ but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
+ and the C11 standard allows this. Work around this problem by
+ using __alignof__ (which returns 8 for double) rather than _Alignof
+ (which returns 4), and align each union member accordingly. */
+# ifdef __GNUC__
+# define _GL_STDDEF_ALIGNAS(type) \
+ __attribute__ ((__aligned__ (__alignof__ (type))))
+# else
+# define _GL_STDDEF_ALIGNAS(type) /* */
+# endif
typedef union
{
- char *__p;
- double __d;
- long double __ld;
- long int __i;
+ char *__p _GL_STDDEF_ALIGNAS (char *);
+ double __d _GL_STDDEF_ALIGNAS (double);
+ long double __ld _GL_STDDEF_ALIGNAS (long double);
+ long int __i _GL_STDDEF_ALIGNAS (long int);
} max_align_t;
#endif
diff --git a/src/gl/string.in.h b/src/gl/string.in.h
index ebd727eda1..2abd6bc0e1 100644
--- a/src/gl/string.in.h
+++ b/src/gl/string.in.h
@@ -15,16 +15,32 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
-#ifndef _@GUARD_PREFIX@_STRING_H
-
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
+#if defined _GL_ALREADY_INCLUDING_STRING_H
+/* Special invocation convention:
+ - On OS X/NetBSD we have a sequence of nested includes
+ <string.h> -> <strings.h> -> "string.h"
+ In this situation system _chk variants due to -D_FORTIFY_SOURCE
+ might be used after any replacements defined here. */
+
+#@INCLUDE_NEXT@ @NEXT_STRING_H@
+
+#else
+/* Normal invocation convention. */
+
+#ifndef _@GUARD_PREFIX@_STRING_H
+
+#define _GL_ALREADY_INCLUDING_STRING_H
+
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
+#undef _GL_ALREADY_INCLUDING_STRING_H
+
#ifndef _@GUARD_PREFIX@_STRING_H
#define _@GUARD_PREFIX@_STRING_H
@@ -1027,3 +1043,4 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
#endif /* _@GUARD_PREFIX@_STRING_H */
#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif
diff --git a/src/gl/xalloc.h b/src/gl/xalloc.h
index 68f847a2c4..81ef680a3a 100644
--- a/src/gl/xalloc.h
+++ b/src/gl/xalloc.h
@@ -41,7 +41,8 @@ extern "C" {
# define _GL_ATTRIBUTE_MALLOC
#endif
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if ! defined __clang__ && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
#else
# define _GL_ATTRIBUTE_ALLOC_SIZE(args)