Commit cdd0de4b authored by Paul Eggert's avatar Paul Eggert

Merge from gnulib.

2013-05-15 manywarnings: update for GCC 4.8.0
2013-05-15 stdio: use __REDIRECT for fwrite, fwrite_unlocked
2013-05-15 sig2str, stdio, warnings: port to clang
parent 9df4ec5e
2013-05-16 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib, incorporating:
2013-05-15 manywarnings: update for GCC 4.8.0
2013-05-15 stdio: use __REDIRECT for fwrite, fwrite_unlocked
2013-05-15 sig2str, stdio, warnings: port to clang
2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca> 2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
* Makefile.in (install-doc): DOC file is not version specific any more. * Makefile.in (install-doc): DOC file is not version specific any more.
......
...@@ -325,21 +325,25 @@ sig2str (int signum, char *signame) ...@@ -325,21 +325,25 @@ sig2str (int signum, char *signame)
{ {
int rtmin = SIGRTMIN; int rtmin = SIGRTMIN;
int rtmax = SIGRTMAX; int rtmax = SIGRTMAX;
int base, delta;
if (! (rtmin <= signum && signum <= rtmax)) if (! (rtmin <= signum && signum <= rtmax))
return -1; return -1;
if (signum <= rtmin + (rtmax - rtmin) / 2) if (signum <= rtmin + (rtmax - rtmin) / 2)
{ {
int delta = signum - rtmin; strcpy (signame, "RTMIN");
sprintf (signame, delta ? "RTMIN+%d" : "RTMIN", delta); base = rtmin;
} }
else else
{ {
int delta = rtmax - signum; strcpy (signame, "RTMAX");
sprintf (signame, delta ? "RTMAX-%d" : "RTMAX", delta); base = rtmax;
} }
delta = signum - base;
if (delta != 0)
sprintf (signame + 5, "%+d", delta);
return 0; return 0;
} }
} }
...@@ -579,13 +579,23 @@ _GL_CXXALIAS_SYS (fwrite, size_t, ...@@ -579,13 +579,23 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
which sometimes causes an unwanted diagnostic for fwrite calls. which sometimes causes an unwanted diagnostic for fwrite calls.
This affects only function declaration attributes under certain This affects only function declaration attributes under certain
versions of gcc, and is not needed for C++. */ versions of gcc and clang, and is not needed for C++. */
# if (0 < __USE_FORTIFY_LEVEL \ # if (0 < __USE_FORTIFY_LEVEL \
&& __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
&& 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
&& !defined __cplusplus) && !defined __cplusplus)
# undef fwrite # undef fwrite
# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; }) # undef fwrite_unlocked
extern size_t __REDIRECT (rpl_fwrite,
(const void *__restrict, size_t, size_t,
FILE *__restrict),
fwrite);
extern size_t __REDIRECT (rpl_fwrite_unlocked,
(const void *__restrict, size_t, size_t,
FILE *__restrict),
fwrite_unlocked);
# define fwrite rpl_fwrite
# define fwrite_unlocked rpl_fwrite_unlocked
# endif # endif
# endif # endif
_GL_CXXALIASWARN (fwrite); _GL_CXXALIASWARN (fwrite);
......
...@@ -98,6 +98,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], ...@@ -98,6 +98,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-W \ -W \
-Wabi \ -Wabi \
-Waddress \ -Waddress \
-Waggressive-loop-optimizations \
-Wall \ -Wall \
-Warray-bounds \ -Warray-bounds \
-Wattributes \ -Wattributes \
...@@ -125,7 +126,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], ...@@ -125,7 +126,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wformat-security \ -Wformat-security \
-Wformat-y2k \ -Wformat-y2k \
-Wformat-zero-length \ -Wformat-zero-length \
-Wformat=2 \
-Wfree-nonheap-object \ -Wfree-nonheap-object \
-Wignored-qualifiers \ -Wignored-qualifiers \
-Wimplicit \ -Wimplicit \
...@@ -143,9 +143,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], ...@@ -143,9 +143,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wmissing-braces \ -Wmissing-braces \
-Wmissing-declarations \ -Wmissing-declarations \
-Wmissing-field-initializers \ -Wmissing-field-initializers \
-Wmissing-format-attribute \
-Wmissing-include-dirs \ -Wmissing-include-dirs \
-Wmissing-noreturn \
-Wmissing-parameter-type \ -Wmissing-parameter-type \
-Wmissing-prototypes \ -Wmissing-prototypes \
-Wmudflap \ -Wmudflap \
...@@ -166,6 +164,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], ...@@ -166,6 +164,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wpointer-sign \ -Wpointer-sign \
-Wpointer-to-int-cast \ -Wpointer-to-int-cast \
-Wpragmas \ -Wpragmas \
-Wreturn-local-addr \
-Wreturn-type \ -Wreturn-type \
-Wsequence-point \ -Wsequence-point \
-Wshadow \ -Wshadow \
...@@ -187,7 +186,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], ...@@ -187,7 +186,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wtype-limits \ -Wtype-limits \
-Wuninitialized \ -Wuninitialized \
-Wunknown-pragmas \ -Wunknown-pragmas \
-Wunreachable-code \
-Wunsafe-loop-optimizations \ -Wunsafe-loop-optimizations \
-Wunused \ -Wunused \
-Wunused-but-set-parameter \ -Wunused-but-set-parameter \
......
# warnings.m4 serial 7 # warnings.m4 serial 8
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
...@@ -27,7 +27,7 @@ AC_DEFUN([gl_COMPILER_OPTION_IF], ...@@ -27,7 +27,7 @@ AC_DEFUN([gl_COMPILER_OPTION_IF],
AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
gl_save_compiler_FLAGS="$gl_Flags" gl_save_compiler_FLAGS="$gl_Flags"
gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"]) gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $gl_unknown_warnings_are_errors $1"])
AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])], AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
[AS_VAR_SET(gl_Warn, [yes])], [AS_VAR_SET(gl_Warn, [yes])],
[AS_VAR_SET(gl_Warn, [no])]) [AS_VAR_SET(gl_Warn, [no])])
...@@ -38,6 +38,14 @@ AS_VAR_POPDEF([gl_Flags])dnl ...@@ -38,6 +38,14 @@ AS_VAR_POPDEF([gl_Flags])dnl
AS_VAR_POPDEF([gl_Warn])dnl AS_VAR_POPDEF([gl_Warn])dnl
]) ])
# gl_UNKNOWN_WARNINGS_ARE_ERRORS
# ------------------------------
# Clang doesn't complain about unknown warning options unless one also
# specifies -Wunknown-warning-option -Werror. Detect this.
AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
[gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
[gl_unknown_warnings_are_errors=])])
# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS], # gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
# [PROGRAM = AC_LANG_PROGRAM()]) # [PROGRAM = AC_LANG_PROGRAM()])
...@@ -47,7 +55,8 @@ AS_VAR_POPDEF([gl_Warn])dnl ...@@ -47,7 +55,8 @@ AS_VAR_POPDEF([gl_Warn])dnl
# #
# If VARIABLE is a variable name, AC_SUBST it. # If VARIABLE is a variable name, AC_SUBST it.
AC_DEFUN([gl_WARN_ADD], AC_DEFUN([gl_WARN_ADD],
[gl_COMPILER_OPTION_IF([$1], [AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
gl_COMPILER_OPTION_IF([$1],
[gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])], [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
[], [],
[$3]) [$3])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment