* lib/Automake/Channels.pm: Fix typo in comment.
(_print_message): If -Werror is enabled, print a 'warnings are
treated as errors' note before the first such warning.
* tests/warnopts.test: Adjust comment to mention expected warning.
Adjust code to ignore 'warnings are treated as errors' note.
* tests/location.test: Adjust expected output with -Werror.
* tests/werror4.test: New test.
* tests/Makefile.am: Update.
* NEWS: Update.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2010-04-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Print 'warnings are treated as errors' note if needed.
+ * lib/Automake/Channels.pm: Fix typo in comment.
+ (_print_message): If -Werror is enabled, print a 'warnings are
+ treated as errors' note before the first such warning.
+ * tests/warnopts.test: Adjust comment to mention expected warning.
+ Adjust code to ignore 'warnings are treated as errors' note.
+ * tests/location.test: Adjust expected output with -Werror.
+ * tests/werror4.test: New test.
+ * tests/Makefile.am: Update.
+ * NEWS: Update.
+
Ensure we don't print 'warning:' or 'error:' twice.
* Makefile.am (sc_ensure_testsuite_has_run): New helper rule.
(sc_tests_logs_duplicate_prefixes): New rule, to check for
- "make dist" can now create lzip-compressed tarballs.
- Messages of types warning or error from `automake' and `aclocal' are now
- prefixed with the respective type.
+ prefixed with the respective type, and presence of -Werror is noted.
Bugs fixed in 1.11a:
The type of the channel. One of C<'debug'>, C<'warning'>, C<'error'>, or
C<'fatal'>. Fatal messages abort the program when they are output.
Error messages update the exit status. Debug and warning messages are
-harmless, except that warnings can be treated as errors of
+harmless, except that warnings are treated as errors if
C<$warnings_are_errors> is set.
=item C<exit_code =E<gt> 1>
$partial = '';
}
+ msg ('note', '', 'warnings are treated as errors', uniq_scope => US_GLOBAL)
+ if ($opts{'type'} eq 'warning' && $warnings_are_errors);
+
# Check for duplicate message if requested.
my $to_filter;
if ($opts{'uniq_part'} ne UP_NONE)
werror.test \
werror2.test \
werror3.test \
+werror4.test \
whoami.test \
xsource.test \
xz.test \
werror.test \
werror2.test \
werror3.test \
+werror4.test \
whoami.test \
xsource.test \
xz.test \
AUTOMAKE_fails -Werror
sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
-diff expected observed || Exit 1
+( echo 'automake: warnings are treated as errors'; cat expected ) \
+ | diff - observed || Exit 1
:
#! /bin/sh
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2010 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
$ACLOCAL
AUTOMAKE_fails
# The expected diagnostic is
-# Makefile.am:3: unused variable: `foo_SOURCES'
-# sub/Makefile.am:2: `INCLUDES' is the old name for `AM_CPPFLAGS'
+# Makefile.am:3: warning: variable `foo_SOURCES' is defined but no program or
+# library has `foo' as canonical name (possible typo)
+# sub/Makefile.am:2: warning: `INCLUDES' is the old name for `AM_CPPFLAGS'
grep '^Makefile.am:.*foo_SOURCES' stderr
grep '^sub/Makefile.am:.*INCLUDES' stderr
grep '^sub/Makefile.am:.*foo_SOURCES' stderr && Exit 1
grep '^Makefile.am:.*INCLUDES' stderr && Exit 1
# Only three lines of warnings.
-test `wc -l < stderr` = 3
+test `grep -v 'warnings are treated as errors' stderr | wc -l` = 3
# On fast machines the autom4te.cache created during the above run of
# $AUTOMAKE is likely to have the same time stamp as the configure.in
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# -Werror and local -Werror settings should be flagged for the user.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<\END
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+cat >sub/Makefile.am <<\END
+AUTOMAKE_OPTIONS = -Werror
+SUB = foo
+SUB = bar
+END
+cat >Makefile.am <<\END
+AUTOMAKE_OPTIONS = -Werror
+VAR = foo
+VAR = bar
+END
+
+$ACLOCAL
+
+AUTOMAKE_fails -Wno-error
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+test `grep -c 'warnings are treated as errors' stderr` -eq 1
+
+sed '/AUTOMAKE_OPTIONS/d' sub/Makefile.am > t
+mv -f t sub/Makefile.am
+
+AUTOMAKE_fails -Wno-error
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+test `grep -c 'warnings are treated as errors' stderr` -eq 1
+
+sed '/AUTOMAKE_OPTIONS/d' Makefile.am > t
+mv -f t Makefile.am
+
+AUTOMAKE_fails -Werror
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+test `grep -c 'warnings are treated as errors' stderr` -eq 1
+
+AUTOMAKE_run 0 -Wno-error
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+grep 'warnings are treated as errors' stderr && Exit 1
+
+: