Hash :
db93b31d
Author :
Date :
2011-11-04T12:50:49
warnings: fix buglets for portability warnings * lib/Automake/ChannelDefs.pm (switch_warning): Ensure the correct implications and inter-dependencies between warnings in the categories `portability', `extra-portability' and `recursive-portability' are respected. Also add detailed explicative comments, and references to the relevant tests. * tests/dollarvar2.test: Update and extend. Also, remove some unnecessary uses of `--force' option in automake calls. * tests/extra-portability3.test: New test. * tests/Makefile.am (TESTS): Add it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
#!/bin/sh
# Copyright (C) 2009 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test to make sure that -Wportability turns on portability-recursive,
# likewise for -Wno-...
. ./defs || Exit 1
set -e
#
# First, try a setup where we have a `portability-recursive' warning,
# but no "simple" `portability' warning.
#
cat >Makefile.am <<'EOF'
x = 1
bla = $(foo$(x))
EOF
$ACLOCAL
# Enabling `portability' warnings should enable `portability-recursive'
# warnings.
AUTOMAKE_fails -Wnone -Wportability
grep 'recursive variable expansion' stderr
# `portability-recursive' warnings can be enabled by themselves.
AUTOMAKE_fails -Wnone -Wportability-recursive
grep 'recursive variable expansion' stderr
# Various ways to disable `portability-recursive'.
$AUTOMAKE -Wno-all
$AUTOMAKE -Wno-portability
$AUTOMAKE -Wall -Wno-portability-recursive
# `-Wno-portability-recursive' after `-Wportability' correctly disables
# `portability-recursive' warnings.
$AUTOMAKE -Wportability -Wno-portability-recursive
# `-Wno-portability' disables `portability-recursive' warnings; but
# a later `-Wportability-recursive' re-enables them. This time, we
# use AUTOMAKE_OPTIONS to specify the warning levels.
echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
$AUTOMAKE
echo 'AUTOMAKE_OPTIONS += -Wportability-recursive' >> Makefile.am
AUTOMAKE_fails
grep 'recursive variable expansion' stderr
#
# Now try a setup where we have both a `portability' warning and
# a `portability-recursive' one.
#
cat >Makefile.am <<'EOF'
x = 1
bla = $(foo$(x))
noinst_PROGRAMS = foo
foo_CPPFLAGS = -Dwhatever
EOF
echo AC_PROG_CC >> configure.in
$ACLOCAL --force
# Can disable both `portability' and `portability-recursive' warnings.
$AUTOMAKE -Wno-portability
# Disabling `portability-recursive' warnings should not disable
# `portability' warnings.
AUTOMAKE_fails -Wportability -Wno-portability-recursive
grep AM_PROG_CC_C_O stderr
grep 'recursive variable expansion' stderr && Exit 1
# Enabling `portability-recursive' warnings should not enable
# all the `portability' warning.
AUTOMAKE_fails -Wno-portability -Wportability-recursive
grep AM_PROG_CC_C_O stderr && Exit 1
grep 'recursive variable expansion' stderr
: