forked from rockdaboot/wget2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* .gitignore: Add exception m4/wget_manywarnings.m4 * configure.ac: Remove manywarnings m4 code * m4/wget_manywarnings.m4: Add manywarnings m4 code here
- Loading branch information
1 parent
f877389
commit f68819c
Showing
3 changed files
with
91 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# wget_manywarnings.m4 serial 1 | ||
dnl Copyright (C) 2016 Free Software Foundation, Inc. | ||
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 Tim Ruehsen | ||
|
||
# wget_WORD_SET(RESULT, SET, WORDS) | ||
# -------------------------------------------------- | ||
# Add each word in WORDS to SET if not already there and store in RESULT. | ||
# Words separated by whitespace. | ||
AC_DEFUN([wget_WORD_SET], [ | ||
ret=$2 | ||
words=" $2 " | ||
for word in $3; do | ||
if test "${words#*" $word "}" = "$words"; then ret="$ret $word"; fi | ||
done | ||
$1=$ret | ||
]) | ||
|
||
# wget_WORD_REMOVE(RESULT, SET, WORDS) | ||
# -------------------------------------------------- | ||
# Remove each word in WORDS from SET and store in RESULT. | ||
# Words separated by whitespace. | ||
AC_DEFUN([wget_WORD_REMOVE], [ | ||
ret= | ||
words=" $3 " | ||
for word in $2; do | ||
if test "${words#*" $word "}" = "$words"; then ret="$ret $word"; fi | ||
done | ||
$1=$ret | ||
]) | ||
|
||
# wget_MANYWARNINGS(VARIABLE, LANGUAGE) | ||
# ----------------------------- | ||
# Add LANGUAGE related GCC warnings to VARIABLE. | ||
# This only works for gcc >= 4.3. | ||
AC_DEFUN([wget_MANYWARNINGS], [ | ||
# | ||
# check if manywarnings is requested | ||
# | ||
AC_ARG_ENABLE([manywarnings], | ||
[AS_HELP_STRING([--enable-manywarnings], [Turn on extra compiler warnings (for developers)])], | ||
[case $enableval in | ||
yes|no) ;; | ||
*) AC_MSG_ERROR([Bad value $enableval for --enable-manywarnings option]) ;; | ||
esac | ||
wget_manywarnings=$enableval | ||
], [ | ||
test -f .manywarnings && wget_manywarnings=yes || wget_manywarnings=no | ||
] | ||
) | ||
$1="" | ||
if test "$wget_manywarnings" = yes; then | ||
# AC_PROG_CC sets $GCC to 'yes' if compiler is gcc | ||
# AC_REQUIRE([AC_PROG_CC]) | ||
CCNAME=$($CC --version | { | ||
IFS=' -' read name x _ | ||
if test "$x" = clang; then | ||
echo $x | ||
else | ||
echo $name | ||
fi | ||
}) | ||
if test "$CCNAME" = "gcc"; then | ||
test -n "$2" && wget_LANGUAGE=$2 || wget_LANGUAGE=C | ||
# add -Wall -Wextra to reduce number of warn flags | ||
wget_WORD_SET([wget_WARN_CFLAGS], [$CFLAGS], ["-Wall -Wextra -Wformat=2"]) | ||
# collect all disabled warn flags in $WARN_CFLAGS | ||
wget_WARN_CFLAGS=$wget_WARN_CFLAGS" "$(gcc $wget_WARN_CFLAGS -Q --help=warning,$wget_LANGUAGE|\ | ||
awk '{ if (([$]2 == "[[disabled]]" || [$]2 == "") && [$]1!~/=/ && [$]1~/^-W/&& [$]1!="-Wall") print [$]1 }') | ||
wget_WARN_CFLAGS=$wget_WARN_CFLAGS" -Warray-bounds=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2" | ||
elif test "$CCNAME" = "clang"; then | ||
# set all warn flags on | ||
wget_WORD_SET([wget_WARN_CFLAGS], [$CFLAGS], ["-Weverything"]) | ||
fi | ||
$1=$wget_WARN_CFLAGS | ||
fi | ||
]) |