2023-07-09 20:05:01 +00:00
|
|
|
# warnings.m4 serial 19
|
2023-01-01 10:31:12 +00:00
|
|
|
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
dnl This file is free software; the Free Software Foundation
|
|
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
|
|
|
|
|
|
dnl From Simon Josefsson
|
|
|
|
|
2023-06-07 19:00:15 +00:00
|
|
|
AC_PREREQ([2.64])
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
|
2012-05-26 23:14:36 +00:00
|
|
|
# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
|
|
|
|
# [PROGRAM = AC_LANG_PROGRAM()])
|
|
|
|
# -----------------------------------------------------------------
|
|
|
|
# Check if the compiler supports OPTION when compiling PROGRAM.
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
#
|
2017-08-09 18:38:04 +00:00
|
|
|
# The effects of this macro depend on the current language (_AC_LANG).
|
2012-05-26 23:14:36 +00:00
|
|
|
AC_DEFUN([gl_COMPILER_OPTION_IF],
|
2017-08-09 18:38:04 +00:00
|
|
|
[
|
|
|
|
AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
|
2013-08-19 05:23:05 +00:00
|
|
|
AS_LITERAL_IF([$1],
|
|
|
|
[m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))],
|
|
|
|
[gl_positive="$1"
|
|
|
|
case $gl_positive in
|
|
|
|
-Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
|
|
|
|
esac
|
|
|
|
m4_pushdef([gl_Positive], [$gl_positive])])dnl
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
gl_save_compiler_FLAGS="$gl_Flags"
|
2023-06-07 19:00:15 +00:00
|
|
|
AS_VAR_APPEND(m4_defn([gl_Flags]),
|
2013-08-19 05:23:05 +00:00
|
|
|
[" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])],
|
|
|
|
[AS_VAR_SET([gl_Warn], [yes])],
|
|
|
|
[AS_VAR_SET([gl_Warn], [no])])
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
gl_Flags="$gl_save_compiler_FLAGS"
|
|
|
|
])
|
2012-05-26 23:14:36 +00:00
|
|
|
AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
|
2013-08-19 05:23:05 +00:00
|
|
|
m4_popdef([gl_Positive])dnl
|
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs. It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable. This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 07:45:59 +00:00
|
|
|
AS_VAR_POPDEF([gl_Flags])dnl
|
|
|
|
AS_VAR_POPDEF([gl_Warn])dnl
|
|
|
|
])
|
2012-05-26 23:14:36 +00:00
|
|
|
|
2013-05-16 07:10:39 +00:00
|
|
|
# gl_UNKNOWN_WARNINGS_ARE_ERRORS
|
|
|
|
# ------------------------------
|
|
|
|
# Clang doesn't complain about unknown warning options unless one also
|
|
|
|
# specifies -Wunknown-warning-option -Werror. Detect this.
|
2017-08-09 18:38:04 +00:00
|
|
|
#
|
|
|
|
# The effects of this macro depend on the current language (_AC_LANG).
|
2013-05-16 07:10:39 +00:00
|
|
|
AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
|
2017-08-09 18:38:04 +00:00
|
|
|
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
|
|
|
|
|
|
|
|
# Specialization for _AC_LANG = C. This macro can be AC_REQUIREd.
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
|
2017-08-09 18:38:04 +00:00
|
|
|
[
|
|
|
|
AC_LANG_PUSH([C])
|
|
|
|
gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
|
|
|
|
AC_LANG_POP([C])
|
|
|
|
])
|
|
|
|
|
|
|
|
# Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd.
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
|
2017-08-09 18:38:04 +00:00
|
|
|
[
|
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
|
|
|
|
AC_LANG_POP([C++])
|
|
|
|
])
|
|
|
|
|
2018-02-20 21:42:19 +00:00
|
|
|
# Specialization for _AC_LANG = Objective C. This macro can be AC_REQUIREd.
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)],
|
2018-02-20 21:42:19 +00:00
|
|
|
[
|
|
|
|
AC_LANG_PUSH([Objective C])
|
|
|
|
gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
|
|
|
|
AC_LANG_POP([Objective C])
|
|
|
|
])
|
|
|
|
|
2017-08-09 18:38:04 +00:00
|
|
|
AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL],
|
2013-05-16 07:10:39 +00:00
|
|
|
[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
|
|
|
|
[gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
|
|
|
|
[gl_unknown_warnings_are_errors=])])
|
2012-05-26 23:14:36 +00:00
|
|
|
|
2017-08-09 18:38:04 +00:00
|
|
|
# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS/WARN_CXXFLAGS],
|
2012-05-26 23:14:36 +00:00
|
|
|
# [PROGRAM = AC_LANG_PROGRAM()])
|
2017-08-09 18:38:04 +00:00
|
|
|
# -----------------------------------------------------------
|
2023-07-09 20:05:01 +00:00
|
|
|
# Adds OPTION to VARIABLE (which defaults to WARN_CFLAGS or WARN_CXXFLAGS)
|
|
|
|
# if the compiler supports it when compiling PROGRAM.
|
2012-05-26 23:14:36 +00:00
|
|
|
#
|
|
|
|
# If VARIABLE is a variable name, AC_SUBST it.
|
2017-08-09 18:38:04 +00:00
|
|
|
#
|
|
|
|
# The effects of this macro depend on the current language (_AC_LANG).
|
2023-07-09 20:05:01 +00:00
|
|
|
#
|
|
|
|
# Example: gl_WARN_ADD([-Wparentheses]).
|
2012-05-26 23:14:36 +00:00
|
|
|
AC_DEFUN([gl_WARN_ADD],
|
2017-08-09 18:38:04 +00:00
|
|
|
[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)])
|
2013-05-16 07:10:39 +00:00
|
|
|
gl_COMPILER_OPTION_IF([$1],
|
2023-06-07 19:00:15 +00:00
|
|
|
[AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" $1"])],
|
2012-05-26 23:14:36 +00:00
|
|
|
[],
|
|
|
|
[$3])
|
|
|
|
m4_ifval([$2],
|
|
|
|
[AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
|
2017-08-09 18:38:04 +00:00
|
|
|
[AC_SUBST([WARN_]_AC_LANG_PREFIX[FLAGS])])dnl
|
2012-05-26 23:14:36 +00:00
|
|
|
])
|
|
|
|
|
2023-06-07 19:00:15 +00:00
|
|
|
|
|
|
|
# gl_CC_INHIBIT_WARNINGS
|
|
|
|
# sets and substitutes a variable GL_CFLAG_INHIBIT_WARNINGS, to a $(CC) option
|
|
|
|
# that reverts all preceding -W* options, if available.
|
|
|
|
# This is expected to be '-w' at least on gcc, clang, AIX xlc, xlclang, Sun cc,
|
|
|
|
# "compile cl" (MSVC), "compile clang-cl" (MSVC-compatible clang). Or it can be
|
|
|
|
# empty.
|
|
|
|
AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
|
|
AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
|
|
|
|
[gl_cv_cc_winhibit],
|
|
|
|
[rm -f conftest*
|
|
|
|
echo 'int dummy;' > conftest.c
|
|
|
|
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
|
|
|
|
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null
|
|
|
|
if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
|
|
|
|
gl_cv_cc_winhibit='-w'
|
|
|
|
else
|
|
|
|
gl_cv_cc_winhibit=none
|
|
|
|
fi
|
|
|
|
rm -f conftest*
|
|
|
|
])
|
|
|
|
case "$gl_cv_cc_winhibit" in
|
|
|
|
none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
|
2023-07-09 20:05:01 +00:00
|
|
|
*)
|
|
|
|
GL_CFLAG_INHIBIT_WARNINGS="$gl_cv_cc_winhibit"
|
|
|
|
dnl If all warnings are inhibited, there's no point in having the GCC
|
|
|
|
dnl analyzer enabled. This saves RAM requirements and CPU consumption.
|
|
|
|
gl_WARN_ADD([-fno-analyzer], [GL_CFLAG_INHIBIT_WARNINGS])
|
|
|
|
;;
|
2023-06-07 19:00:15 +00:00
|
|
|
esac
|
|
|
|
AC_SUBST([GL_CFLAG_INHIBIT_WARNINGS])
|
|
|
|
])
|
|
|
|
|
|
|
|
# gl_CXX_INHIBIT_WARNINGS
|
|
|
|
# sets and substitutes a variable GL_CXXFLAG_INHIBIT_WARNINGS, to a $(CC) option
|
|
|
|
# that reverts all preceding -W* options, if available.
|
|
|
|
AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
|
|
|
|
[
|
|
|
|
dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX.
|
|
|
|
if test -n "$CXX" && test "$CXX" != no; then
|
|
|
|
AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
|
|
|
|
[gl_cv_cxx_winhibit],
|
|
|
|
[rm -f conftest*
|
|
|
|
echo 'int dummy;' > conftest.cc
|
|
|
|
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
|
|
|
|
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null
|
|
|
|
if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
|
|
|
|
gl_cv_cxx_winhibit='-w'
|
|
|
|
else
|
|
|
|
gl_cv_cxx_winhibit=none
|
|
|
|
fi
|
|
|
|
rm -f conftest*
|
|
|
|
])
|
|
|
|
case "$gl_cv_cxx_winhibit" in
|
|
|
|
none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;
|
2023-07-09 20:05:01 +00:00
|
|
|
*)
|
|
|
|
GL_CXXFLAG_INHIBIT_WARNINGS="$gl_cv_cxx_winhibit"
|
|
|
|
dnl If all warnings are inhibited, there's no point in having the GCC
|
|
|
|
dnl analyzer enabled. This saves RAM requirements and CPU consumption.
|
|
|
|
gl_WARN_ADD([-fno-analyzer], [GL_CXXFLAG_INHIBIT_WARNINGS])
|
|
|
|
;;
|
2023-06-07 19:00:15 +00:00
|
|
|
esac
|
|
|
|
else
|
|
|
|
GL_CXXFLAG_INHIBIT_WARNINGS=''
|
|
|
|
fi
|
|
|
|
AC_SUBST([GL_CXXFLAG_INHIBIT_WARNINGS])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2012-05-26 23:14:36 +00:00
|
|
|
# Local Variables:
|
|
|
|
# mode: autoconf
|
|
|
|
# End:
|