automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: Re: -Woverride


From: Alexandre Duret-Lutz
Subject: FYI: Re: -Woverride
Date: Mon, 14 Apr 2003 21:11:13 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

>>> "Rich" == Richard Dawe <address@hidden> writes:

[...]

 Rich> I noticed that C<syntax> did not have "Warnings about" in front of its
 Rich> description. Maybe you could fix that too?

Sure, thanks!

Here is the patch I'm checking in.  I've also listed DEJATOOL as
a variable which is legitimate to override (so that Richard's
patch doesn't fail :)), and fixed location.test (which I forgot
yesterday).

2003-04-14  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (%silent_variable_override): New variable.
        (macro_define): Warn about variable definitions overriding
        Automake variables.
        (rule_define): Warn about target definitions overriding
        Automake variables.  Fix $condmsg definition.
        * automake.texi (Invoking Automake): Document the `override'
        category.
        * lib/Automake/ChannelDefs.pm (usage): Likewise.
        * lib/am/texinfos.am [!%?CYGNUS] (MAKEINFO): Do not define,
        this is already done in m4/init.m4.
        * tests/dejagnu2.test: Run $MAKE, don't only grep.  Use
        -Wno-override, and make sure we get a warning without.
        * tests/exeext2.test, tests/substtarg.test: Use -Wno-override,
        and make sure we get a warning without.
        * tests/exeext3.test, tests/java2.test, tests/nolink.test,
        tests/subpkg.test, tests/vartest.test: Use -Wno-override.
        * tests/txinfo13.test: Use installcheck-local instead of overriding
        installcheck.
        * tests/txinfo2.test: Run $MAKE on the real Makefile (this test
        used to succeed thanks to a failure...)
        * tests/location.test: Adjust expected messages.
        * tests/Makefile.am (XFAIL_TESTS): Add txinfo5.test.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.207
diff -u -r1.207 NEWS
--- NEWS        6 Apr 2003 18:31:11 -0000       1.207
+++ NEWS        14 Apr 2003 19:05:48 -0000
@@ -64,6 +64,8 @@
   substituted from configure.ac.  This has been requested by people
   dealing with non-POSIX ar implementations.
 
+* New warning option: -Woverride.  This will warn about any user
+  target or variable definitions which override Automake definitions.
 
 New in 1.7:
 * Autoconf 2.54 is required.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1444
diff -u -r1.1444 automake.in
--- automake.in 12 Apr 2003 11:16:51 -0000      1.1444
+++ automake.in 14 Apr 2003 19:05:57 -0000
@@ -276,6 +276,13 @@
    YACC => 'AC_PROG_YACC',
    );
 
+# Variables that can be overriden without complaint from -Woverride
+my %silent_variable_override =
+  (AR => 1,
+   ARFLAGS => 1,
+   DEJATOOL => 1,
+   JAVAC => 1);
+
 # Copyright on generated Makefile.ins.
 my $gen_copyright = "\
 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
@@ -6376,9 +6383,19 @@
          && $var_owner{$var}{$cond} != VAR_AUTOMAKE
          && $owner == VAR_AUTOMAKE)
        {
+         if (! exists $silent_variable_override{$var})
+           {
+             my $condmsg = ($cond == TRUE
+                            ? '' : (" in condition `" . $cond->human . "'"));
+             msg_cond_var ('override', $cond, $var,
+                           "user variable `$var' defined here$condmsg...",
+                           partial => 1);
+             msg ('override', $where,
+                  "... overrides Automake variable `$var' defined here");
+           }
          verb ("refusing to override the user definition of:\n"
                . macro_dump ($var)
-               ."with `$cond->human' => `$value'");
+               ."with `" . $cond->human . "' => `$value'");
        }
       else
        {
@@ -7133,11 +7150,11 @@
 
       # Don't mention true conditions in diagnostics.
       my $condmsg =
-       $cond == TRUE ? " in condition `" . $cond->human . "'" : '';
+       $cond == TRUE ? '' : " in condition `" . $cond->human . "'";
 
       if ($owner == TARGET_USER)
        {
-         if ($oldowner eq TARGET_USER)
+         if ($oldowner == TARGET_USER)
            {
              # Ignore `%'-style pattern rules.  We'd need the
              # dependencies to detect duplicates, and they are
@@ -7174,6 +7191,11 @@
        {
          if ($oldowner == TARGET_USER)
            {
+             msg_cond_target ('override', $cond, $target,
+                              "user target `$target' defined here"
+                              . "$condmsg...", partial => 1);
+             msg ('override', $where,
+                  "... overrides Automake target `$target' defined here");
              # Don't overwrite the user definition of TARGET.
              return ();
            }
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.331
diff -u -r1.331 automake.texi
--- automake.texi       10 Apr 2003 20:36:14 -0000      1.331
+++ automake.texi       14 Apr 2003 19:06:05 -0000
@@ -1051,6 +1051,8 @@
 (@pxref{Top, , , standards, The GNU Coding Standards}).
 @item obsolete
 obsolete features or constructions
address@hidden override
+user redefinitions of Automake rules or variables
 @item portability
 portability issues (e.g., use of Make features which are known not portable)
 @item syntax
Index: lib/Automake/ChannelDefs.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/ChannelDefs.pm,v
retrieving revision 1.1
diff -u -r1.1 ChannelDefs.pm
--- lib/Automake/ChannelDefs.pm 31 Dec 2002 21:31:51 -0000      1.1
+++ lib/Automake/ChannelDefs.pm 14 Apr 2003 19:06:09 -0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 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
@@ -98,13 +98,18 @@
 
 Warnings about obsolete features (silent by default).
 
+=item C<override>
+
+Warnings about user redefinitions of Automake rules or
+variables (silent by default).
+
 =item C<portability>
 
 Warnings about non-portable constructs.
 
 =item C<syntax>
 
-Weird syntax, unused variables, typos...
+Warnings about weird syntax, unused variables, typos...
 
 =item C<unsupported>
 
@@ -139,6 +144,7 @@
 
 register_channel 'gnu', type => 'warning';
 register_channel 'obsolete', type => 'warning', silent => 1;
+register_channel 'override', type => 'warning', silent => 1;
 register_channel 'portability', type => 'warning', silent => 1;
 register_channel 'syntax', type => 'warning';
 register_channel 'unsupported', type => 'warning';
@@ -161,6 +167,7 @@
   print "Warning categories include:
   `gnu'           GNU coding standards (default in gnu and gnits modes)
   `obsolete'      obsolete features or constructions
+  `override'      user redefinitions of Automake rules or variables
   `portability'   portability issues
   `syntax'        dubious syntactic constructs (default)
   `unsupported'   unsupported or incomplete features (default)
Index: lib/am/texinfos.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/texinfos.am,v
retrieving revision 1.101
diff -u -r1.101 texinfos.am
--- lib/am/texinfos.am  19 Feb 2003 19:12:55 -0000      1.101
+++ lib/am/texinfos.am  14 Apr 2003 19:06:09 -0000
@@ -24,7 +24,6 @@
 
 if %?LOCAL-TEXIS%
 if ! %?CYGNUS%
-MAKEINFO = @MAKEINFO@
 TEXI2DVI = texi2dvi
 
 else %?CYGNUS%
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.479
diff -u -r1.479 Makefile.am
--- tests/Makefile.am   11 Apr 2003 22:11:43 -0000      1.479
+++ tests/Makefile.am   14 Apr 2003 19:06:09 -0000
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-XFAIL_TESTS = subdir5.test auxdir2.test cond17.test
+XFAIL_TESTS = subdir5.test auxdir2.test cond17.test txinfo5.test
 
 TESTS =        \
 acinclude.test \
Index: tests/dejagnu2.test
===================================================================
RCS file: /cvs/automake/automake/tests/dejagnu2.test,v
retrieving revision 1.3
diff -u -r1.3 dejagnu2.test
--- tests/dejagnu2.test 8 Sep 2002 13:07:55 -0000       1.3
+++ tests/dejagnu2.test 14 Apr 2003 19:06:09 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -22,15 +22,29 @@
 
 . ./defs || exit 1
 
+set -e
+
+echo 'AC_OUTPUT' >> configure.in
+
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
 
 site.exp:
-    echo foo
+       @echo foo
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -Wno-override
 
 grep site.exp Makefile.in
 test `grep '^site\.exp:' Makefile.in | wc -l` -eq 1
+
+./configure
+$MAKE site.exp >stdout
+cat stdout
+grep foo stdout
+
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'Makefile.am:3:.*site.exp' stderr
Index: tests/exeext2.test
===================================================================
RCS file: /cvs/automake/automake/tests/exeext2.test,v
retrieving revision 1.3
diff -u -r1.3 exeext2.test
--- tests/exeext2.test  8 Sep 2002 13:07:55 -0000       1.3
+++ tests/exeext2.test  14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -41,11 +41,12 @@
 $AUTOMAKE -Wnone
 $AUTOMAKE -Wnone -Wobsolete 2>stderr && exit 1
 cat stderr
-grep maude stderr
+grep 'deprecated.*maude' stderr
 $AUTOMAKE -Wall 2>stderr && exit 1
 cat stderr
-grep maude stderr
+grep 'deprecated.*maude' stderr
+grep 'overrid.*maude' stderr
 
 echo 'AUTOMAKE_OPTIONS = no-exeext' >> Makefile.am
 
-$AUTOMAKE -Wall
+$AUTOMAKE -Wall -Wno-override
Index: tests/exeext3.test
===================================================================
RCS file: /cvs/automake/automake/tests/exeext3.test,v
retrieving revision 1.1
diff -u -r1.1 exeext3.test
--- tests/exeext3.test  29 Sep 2002 10:35:03 -0000      1.1
+++ tests/exeext3.test  14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -36,7 +36,7 @@
 END
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 
 $FGREP 'maude$(EXEEXT):' Makefile.in
 test 1 = `grep 'maude.*:' Makefile.in | wc -l`
Index: tests/java2.test
===================================================================
RCS file: /cvs/automake/automake/tests/java2.test,v
retrieving revision 1.2
diff -u -r1.2 java2.test
--- tests/java2.test    8 Sep 2002 13:07:55 -0000       1.2
+++ tests/java2.test    14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -48,6 +48,6 @@
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 ./configure
 $MAKE
Index: tests/location.test
===================================================================
RCS file: /cvs/automake/automake/tests/location.test,v
retrieving revision 1.3
diff -u -r1.3 location.test
--- tests/location.test 31 Oct 2002 11:55:27 -0000      1.3
+++ tests/location.test 14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -66,11 +66,11 @@
 Makefile.am:3:   while processing library `libfoo.a'
 program.am: target `libfoo.a$(EXEEXT)' was defined here
 Makefile.am:1:   while processing program `libfoo.a'
-program.am: redefinition of `libfoo.a' in condition `TRUE'...
+program.am: redefinition of `libfoo.a'...
 Makefile.am:1:   while processing program `libfoo.a'
 library.am: ... `libfoo.a' previously defined here
 Makefile.am:3:   while processing library `libfoo.a'
-tags.am: redefinition of `ctags' in condition `TRUE'...
+tags.am: redefinition of `ctags'...
 program.am: ... `ctags' previously defined here
 Makefile.am:6:   while processing program `ctags'
 EOF
Index: tests/nolink.test
===================================================================
RCS file: /cvs/automake/automake/tests/nolink.test,v
retrieving revision 1.4
diff -u -r1.4 nolink.test
--- tests/nolink.test   8 Sep 2002 13:07:55 -0000       1.4
+++ tests/nolink.test   14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -22,6 +22,8 @@
 
 . ./defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = no-exeext
 
@@ -32,8 +34,8 @@
        cat beans.veg beef.meat > meal
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -Wno-override
 
 grep '^meal.*:' Makefile.in | grep -v beef.meat && exit 1
 
Index: tests/subpkg.test
===================================================================
RCS file: /cvs/automake/automake/tests/subpkg.test,v
retrieving revision 1.4
diff -u -r1.4 subpkg.test
--- tests/subpkg.test   21 Jan 2003 18:02:34 -0000      1.4
+++ tests/subpkg.test   14 Apr 2003 19:06:10 -0000
@@ -88,12 +88,12 @@
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 
 cd lib
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 cd ..
 
 ./configure
Index: tests/substtarg.test
===================================================================
RCS file: /cvs/automake/automake/tests/substtarg.test,v
retrieving revision 1.2
diff -u -r1.2 substtarg.test
--- tests/substtarg.test        8 Sep 2002 13:07:56 -0000       1.2
+++ tests/substtarg.test        14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -47,6 +47,9 @@
 set -e
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'address@hidden@.a' stderr
 num=`grep 'address@hidden@.a:' Makefile.in | wc -l`
 test $num -eq 1
+$AUTOMAKE -Wno-override
Index: tests/txinfo13.test
===================================================================
RCS file: /cvs/automake/automake/tests/txinfo13.test,v
retrieving revision 1.1
diff -u -r1.1 txinfo13.test
--- tests/txinfo13.test 13 Jan 2003 19:17:54 -0000      1.1
+++ tests/txinfo13.test 14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -32,7 +32,7 @@
 info_TEXINFOS = subdir/main.texi
 subdir_main_TEXINFOS = subdir/inc.texi
 
-installcheck:
+installcheck-local:
        test -f $(infodir)/main.info
 END
 
Index: tests/txinfo2.test
===================================================================
RCS file: /cvs/automake/automake/tests/txinfo2.test,v
retrieving revision 1.1
diff -u -r1.1 txinfo2.test
--- tests/txinfo2.test  13 Jan 2003 19:17:54 -0000      1.1
+++ tests/txinfo2.test  14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -23,6 +23,10 @@
 
 . ./defs || exit 1
 
+set -e
+
+echo AC_OUTPUT >> configure.in
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 magic:
@@ -33,7 +37,12 @@
 echo '@setfilename textutils.info' > textutils.texi
 : > textutils.info~
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
 
-test -z "`$MAKE -s -f Makefile.in magic | grep '~'`"
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE magic >stdout
+cat stdout
+grep '~' stdout && exit 1
+exit 0
Index: tests/vartar.test
===================================================================
RCS file: /cvs/automake/automake/tests/vartar.test,v
retrieving revision 1.4
diff -u -r1.4 vartar.test
--- tests/vartar.test   8 Sep 2002 13:07:56 -0000       1.4
+++ tests/vartar.test   14 Apr 2003 19:06:10 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -22,22 +22,22 @@
 
 . ./defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 install = install
 install:
        $(install) install
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -Wno-override
 
-grep '^install = install$' Makefile.in || exit 1
+grep '^install = install$' Makefile.in
 
 cat > target.expected <<'EOF'
 install:
        $(install) install
 EOF
 sed -n '/^install:/,/^ /p' Makefile.in > target.value
-diff target.expected target.value || exit 1
-
-exit 0
+diff target.expected target.value


-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]