automake-ng
[Top][All Lists]
Advanced

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

[Automake-ng] [PATCH] [ng] vars: don't warn about non-POSIX names or GNU


From: Stefano Lattarini
Subject: [Automake-ng] [PATCH] [ng] vars: don't warn about non-POSIX names or GNU make function calls
Date: Mon, 23 Jan 2012 15:16:13 +0100

This change has the collateral effect of making the warning
category 'portability-recursive' obsolete.

* doc/automake.texi: Adjust and update.
* lib/Automake/ChannelDefs.pm: Don't register the warning channel
'portability-recursive' anymore.
(switch_warning): Don't handle 'portability-recursive' category
anymore.  Related simplifications.
* lib/Automake/Variable.pm ($_VARIABLE_CHARACTERS): Remove.
($_VARIABLE_PATTERN): Likewise.
($_VARIABLE_RECURSIVE_PATTERN): Likewise.
(check_variable_expansions): Likewise.
(define): Don't call it.
* automake.in (read_am_file): Likewise.
(handle_options): Don't try to set/unset warnings in the category
'portability-recursive'.
* tests/test-driver-custom-xfail-tests.test: Remove now redundant
use of '-Wno-portability-recursive' in AUTOMAKE_OPTIONS.
* tests/canon.test: Adjust grepping of automake stderr.
* tests/canon5.test: Likewise.
* tests/gmake-vars.test: New test.
* tests/vars3.test: Remove as obsolete.
* tests/silent-nowarn.test: Likewise.
* tests/dollarvar.test: Likewise.
* tests/dollarvar2.test: Likewise.
* tests/extra-portability3.test: Likewise.
* tests/doc-parsing-buglets-colneq-subst.test: Remove as redundant.
* tests/list-of-tests.mk: Update.
---

I will push this patch in 48 hours if there is no objection.

 automake.in                                 |    7 --
 doc/automake.texi                           |   24 -------
 lib/Automake/ChannelDefs.pm                 |   34 ++--------
 lib/Automake/Variable.pm                    |   45 +-------------
 tests/canon.test                            |    5 +-
 tests/canon5.test                           |    3 +-
 tests/doc-parsing-buglets-colneq-subst.test |   37 -----------
 tests/dollarvar.test                        |   63 ------------------
 tests/dollarvar2.test                       |   91 ---------------------------
 tests/extra-portability3.test               |   60 ------------------
 tests/gmake-vars.test                       |   84 ++++++++++++++++++++++++
 tests/list-of-tests.mk                      |    7 +--
 tests/silent-nowarn.test                    |   44 -------------
 tests/test-driver-custom-xfail-tests.test   |    2 -
 tests/vars3.test                            |   72 ---------------------
 15 files changed, 96 insertions(+), 482 deletions(-)
 delete mode 100755 tests/doc-parsing-buglets-colneq-subst.test
 delete mode 100755 tests/dollarvar.test
 delete mode 100755 tests/dollarvar2.test
 delete mode 100755 tests/extra-portability3.test
 create mode 100755 tests/gmake-vars.test
 delete mode 100755 tests/silent-nowarn.test
 delete mode 100755 tests/vars3.test

diff --git a/automake.in b/automake.in
index 68518e5..ed4bfe0 100644
--- a/automake.in
+++ b/automake.in
@@ -1238,10 +1238,6 @@ sub handle_options
       return 1 if process_option_list (@options);
     }
 
-  # Override portability-recursive warning.
-  switch_warning ('no-portability-recursive')
-    if option 'silent-rules';
-
   if ($strictness == GNITS)
     {
       set_option ('readme-alpha', INTERNAL);
@@ -6709,8 +6705,6 @@ sub read_am_file ($$)
            # Automake::Rule::define). So we go on and ignore the return value.
            Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where);
 
-           check_variable_expansions ($_, $where);
-
            $output_trailer .= $comment . $spacing;
            my $cond = new Automake::Condition @cond_stack;
            $output_trailer .= $cond->subst_string;
@@ -6794,7 +6788,6 @@ sub read_am_file ($$)
            # This isn't an error; it is probably a continued rule.
            # In fact, this is what we assume.
            $prev_state = IN_RULE_DEF;
-           check_variable_expansions ($_, $where);
            $output_trailer .= $comment . $spacing;
            my $cond = new Automake::Condition @cond_stack;
            $output_trailer .= $cond->subst_string;
diff --git a/doc/automake.texi b/doc/automake.texi
index 227a4eb..9d10365 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -1854,16 +1854,6 @@ Makefile constructs, so you're advised to avoid fancy 
constructs or
 For example, @key{TAB} characters cannot be used between a target name
 and the following address@hidden:}'' character, and variable assignments
 shouldn't be indented with @key{TAB} characters.
address@hidden Keep this in sync with doc-parsing-buglets-colneq-subst.test.
-Also, using more complex macro in target names can cause trouble:
-
address@hidden
-% @kbd{cat Makefile.am}
-$(FOO:=x): bar
-% @kbd{automake}
-Makefile.am:1: bad characters in variable name `$(FOO'
-Makefile.am:1: `:='-style assignments are not portable
address@hidden example
 
 @cindex Make targets, overriding
 @cindex Make rules, overriding
@@ -2734,8 +2724,6 @@ variables.
 The categories output by default are @samp{syntax} and
 @samp{unsupported}.  Additionally, @samp{gnu} and @samp{portability}
 are enabled in @option{--gnu} and @option{--gnits} strictness.
-On the other hand, the @option{silent-rules} options (@pxref{Options})
-turns off portability warnings about recursive variable expansions.
 
 @c Checked by extra-portability.test
 Turning off @samp{portability} will also turn off @samp{extra-portability},
@@ -10922,18 +10910,6 @@ For portability to different @command{make} 
implementations, package authors
 are advised to not set the variable @code{V} inside the @file{Makefile.am}
 file, to allow the user to override the value for subdirectories as well.
 
-The current implementation of this feature normally uses nested
-variable expansion @samp{$(@var{var1}$(V))}, a @file{Makefile} feature
-that is not required by POSIX 2008 but is widely supported in
-practice.  The @option{silent-rules} option thus turns off warnings
-about recursive variable expansion, which are in turn enabled by
address@hidden (@pxref{automake Invocation}).  On the rare
address@hidden implementations that do not support nested variable
-expansion, whether rules are silent is always determined at configure
-time, and cannot be overridden at make time.  Future versions of POSIX
-are likely to require nested variable expansion, so this minor
-limitation should go away with time.
-
 @vindex @code{AM_V_GEN}
 @vindex @code{AM_V_at}
 @vindex @code{AM_DEFAULT_VERBOSITY}
diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm
index 3e9fd1b..80fb2ac 100644
--- a/lib/Automake/ChannelDefs.pm
+++ b/lib/Automake/ChannelDefs.pm
@@ -160,7 +160,6 @@ 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 'portability-recursive', type => 'warning', silent => 1;
 register_channel 'syntax', type => 'warning';
 register_channel 'unsupported', type => 'warning';
 
@@ -292,37 +291,18 @@ sub switch_warning ($)
   elsif (channel_type ($cat) eq 'warning')
     {
       setup_channel $cat, silent => $has_no;
-      #
-      # Handling of portability warnings is trickier.  For relevant tests,
-      # see `dollarvar2', `extra-portability' and `extra-portability3'.
-      #
-      # -Wportability-recursive and -Wno-portability-recursive should not
-      # have any effect on other 'portability' or 'extra-portability'
-      # warnings, so there's no need to handle them separately or ad-hoc.
-      #
+      # Handling of portability warnings is trickier.
+      # See 'extra-portability.test'.
       if ($cat eq 'extra-portability' && ! $has_no) # -Wextra-portability
         {
-          # -Wextra-portability must enable 'portability' and
-          # 'portability-recursive' warnings.
+          # '-Wextra-portability' must enable 'portability' warnings.
           setup_channel 'portability', silent => 0;
-          setup_channel 'portability-recursive', silent => 0;
         }
-      if ($cat eq 'portability') # -Wportability or -Wno-portability
+      if ($cat eq 'portability' && $has_no) # -Wno-portability
         {
-          if ($has_no) # -Wno-portability
-            {
-              # -Wno-portability must disable 'extra-portability' and
-              # 'portability-recursive' warnings.
-              setup_channel 'portability-recursive', silent => 1;
-              setup_channel 'extra-portability', silent => 1;
-            }
-          else # -Wportability
-            {
-              # -Wportability must enable 'portability-recursive'
-              # warnings.  But it should have no influence over the
-              # 'extra-portability' warnings.
-              setup_channel 'portability-recursive', silent => 0;
-            }
+          # '-Wno-portability' must disable 'extra-portability'
+          # warnings.
+          setup_channel 'extra-portability', silent => 1;
         }
     }
   else
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index cd57877..6ce4a86 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -34,7 +34,7 @@ use vars '@ISA', '@EXPORT', '@EXPORT_OK';
 @EXPORT = qw (err_var msg_var msg_cond_var reject_var
              var rvar vardef rvardef
              variables
-             scan_variable_expansions check_variable_expansions
+             scan_variable_expansions
              variable_delete
              variables_dump
              set_seen
@@ -753,44 +753,6 @@ sub scan_variable_expansions ($)
   return @result;
 }
 
-=item C<check_variable_expansions ($text, $where)>
-
-Check variable expansions in C<$text> and warn about any name that
-does not conform to POSIX.  C<$where> is the location of C<$text>
-for the error message.
-
-=cut
-
-sub check_variable_expansions ($$)
-{
-  my ($text, $where) = @_;
-  # Catch expansion of variables whose name does not conform to POSIX.
-  foreach my $var (scan_variable_expansions ($text))
-    {
-      if ($var !~ /$_VARIABLE_PATTERN/o)
-       {
-         # If the variable name contains a space, it's likely
-         # to be a GNU make extension (such as $(addsuffix ...)).
-         # Mention this in the diagnostic.
-         my $gnuext = "";
-         $gnuext = "\n(probably a GNU make extension)" if $var =~ / /;
-         # Accept recursive variable expansions if so desired
-         # (we hope they are rather portable in practice).
-         if ($var =~ /$_VARIABLE_RECURSIVE_PATTERN/o)
-           {
-             msg ('portability-recursive', $where,
-                  "$var: non-POSIX recursive variable expansion$gnuext");
-           }
-         else
-           {
-             msg ('portability', $where, "$var: non-POSIX variable 
name$gnuext");
-           }
-       }
-    }
-}
-
-
-
 =item C<Automake::Variable::define($varname, $owner, $type, $cond, $value, 
$comment, $where, $pretty)>
 
 Define or append to a new variable.
@@ -842,9 +804,6 @@ sub define ($$$$$$$$)
                               || $pretty == VAR_SILENT
                               || $pretty == VAR_SORTED);
 
-  error $where, "bad characters in variable name `$var'"
-    if $var !~ /$_VARIABLE_PATTERN/o;
-
   # `:='-style assignments are not acknowledged by POSIX.  Moreover it
   # has multiple meanings.  In GNU make or BSD make it means "assign
   # with immediate expansion", while in OSF make it is used for
@@ -852,8 +811,6 @@ sub define ($$$$$$$$)
   msg ('portability', $where, "`:='-style assignments are not portable")
     if $type eq ':';
 
-  check_variable_expansions ($value, $where);
-
   # If there's a comment, make sure it is \n-terminated.
   if ($comment)
     {
diff --git a/tests/canon.test b/tests/canon.test
index 51e03b2..9279d9f 100755
--- a/tests/canon.test
+++ b/tests/canon.test
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2010, 2011, 2012 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
@@ -30,7 +30,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile\.am:2:.* bad .*variable.*sniff-glue_SOURCES' stderr
 grep 'Makefile\.am:2:.* use .*sniff_glue_SOURCES' stderr
 
 :
diff --git a/tests/canon5.test b/tests/canon5.test
index 43c098b..ccd8930 100755
--- a/tests/canon5.test
+++ b/tests/canon5.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2010, 2011 Free Software
+# Copyright (C) 1999, 2001, 2002, 2003, 2010, 2011, 2012 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -46,7 +46,6 @@ bin_PROGRAMS = ,foo
 END
 
 AUTOMAKE_fails
-grep 'Makefile\.am:2:.* bad .*variable.*,foo_SOURCES' stderr
 grep 'Makefile\.am:2:.* use .*_foo_SOURCES' stderr
 
 cat > Makefile.am << 'END'
diff --git a/tests/doc-parsing-buglets-colneq-subst.test 
b/tests/doc-parsing-buglets-colneq-subst.test
deleted file mode 100755
index f3a68d6..0000000
--- a/tests/doc-parsing-buglets-colneq-subst.test
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011 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/>.
-
-# Check a documented limitation of the Automake's Makefile parser
-# w.r.t. POSIX variable substitutions used in the name of targets.
-# See Section "General Operation" in the Automake manual.
-# If you cause some parts of this test to fail, chances are that you've
-# improved the Automake parser ;-)
-# See: <http://lists.gnu.org/archive/html/automake/2010-08/msg00074.html>
-# or: 
<http://thread.gmane.org/gmane.comp.sysutils.automake.general/11943/focus=11962>
-
-. ./defs || Exit 1
-
-cat > Makefile.am <<'END'
-$(FOO:=x): bar
-END
-
-$ACLOCAL
-AUTOMAKE_fails
-
-grep 'bad characters.*variable name.*\$(FOO' stderr
-grep ':=.*assignments.*not portable' stderr
-
-:
diff --git a/tests/dollarvar.test b/tests/dollarvar.test
deleted file mode 100755
index 9185990..0000000
--- a/tests/dollarvar.test
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2009, 2011 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 complains about recursive
-# variable expansions and variables containing `$', `$(...)', or
-# `${...}' in the name.  We support recursive variable expansions using
-# the latter two constructs for the `silent-rules' option, and they are
-# rather widely supported in practice.  OTOH variable definitions
-# containing a `$' on the left hand side of an assignment are not
-# portable in practice, even though POSIX allows them.  :-/
-
-. ./defs || Exit 1
-
-cat >Makefile.am <<'EOF'
-x = 1
-foo$x = 1
-bar$(x) = 1
-baz${x} = 1
-bla = $(foo$x)
-bli = $(foo$(x))
-blo = $(foo${x})
-EOF
-
-$ACLOCAL
-AUTOMAKE_fails -Wportability
-grep 'Makefile.am:2' stderr
-grep 'Makefile.am:3' stderr
-grep 'Makefile.am:4' stderr
-grep 'Makefile.am:5' stderr
-grep 'Makefile.am:6' stderr
-grep 'Makefile.am:7' stderr
-
-# On the other hand, if we allow `silent-rules' mode, then we need to
-# allow recursive variable expansion, too.
-
-# This should work with the AM_SILENT_RULES macro.
-$sleep
-echo 'AM_SILENT_RULES' >> configure.in
-
-$ACLOCAL --force
-AUTOMAKE_fails -Wportability
-grep 'Makefile.am:2' stderr
-grep 'Makefile.am:3' stderr
-grep 'Makefile.am:4' stderr
-grep 'Makefile.am:5' stderr
-grep 'Makefile.am:6' stderr && Exit 1
-grep 'Makefile.am:7' stderr && Exit 1
-
-
-:
diff --git a/tests/dollarvar2.test b/tests/dollarvar2.test
deleted file mode 100755
index cda9605..0000000
--- a/tests/dollarvar2.test
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2009, 2011 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
-
-#
-# 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
-
-:
diff --git a/tests/extra-portability3.test b/tests/extra-portability3.test
deleted file mode 100755
index 125344d..0000000
--- a/tests/extra-portability3.test
+++ /dev/null
@@ -1,60 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011 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/>.
-
-# Check interactions between the `portability-recursive' and
-# `extra-portability' warning categories.
-
-. ./defs || Exit 1
-
-# We want (almost) complete control over automake options.
-AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror"
-
-cat >>configure.in <<END
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_OUTPUT
-END
-
-$ACLOCAL
-
-cat >Makefile.am <<'END'
-baz = $(foo$(bar))
-lib_LIBRARIES = libfoo.a
-libfoo_a_SOURCES = foo.c
-END
-
-# 'extra-portability' implies 'portability-recursive'.
-AUTOMAKE_fails -Wextra-portability
-grep 'requires.*AM_PROG_AR' stderr
-grep 'recursive variable expansion' stderr
-
-# We can disable 'extra-portability' while leaving
-# 'portability-recursive' intact.
-AUTOMAKE_fails -Wportability-recursive -Wno-extra-portability
-grep 'requires.*AM_PROG_AR' stderr && Exit 1
-grep 'recursive variable expansion' stderr
-
-# We can disable 'portability-recursive' while leaving
-# 'extra-portability' intact.
-AUTOMAKE_fails -Wextra-portability -Wno-portability-recursive
-grep 'requires.*AM_PROG_AR' stderr
-grep 'recursive variable expansion' stderr && Exit 1
-
-# Disabling 'portability' disables 'portability-recursive' and
-# 'extra-portability'.
-$AUTOMAKE -Wextra-portability -Wno-portability
-
-:
diff --git a/tests/gmake-vars.test b/tests/gmake-vars.test
new file mode 100755
index 0000000..7c5ca00
--- /dev/null
+++ b/tests/gmake-vars.test
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 2002, 2010, 2011 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/>.
+
+# Check that Automake does not warns about nested variables expansion,
+# variables with non-POSIX names, or GNU make function calls.
+
+. ./defs || Exit 1
+
+cat > Makefile.am <<'END'
+define get-libname
+$(addprefix lib, $(1))
+endef
+
+v0 = $(shell LC_ALL=C && export LC_ALL && echo foo* bar*)
+v1 = $(sort $(wildcard foo* bar*))
+v2 = $(call get-libname, foo)
+v3 = sub/$(addsuffix .a, ${v2})
+v4 = $(v3)
+v4 += $(notdir ${v3})
+
+x = 1
+mu1 = okey-dokey
+bla = $(mu$x)
+bli = $(mu$(x))
+blo = $(mu${x})
+blu = $(mu1)
+
+bar$(x) = 6
+baz${x} = 7
+zap$x = 8
+
address@hidden;by,gnu/make = wow
+
+.PHONY: do/test my/prereq
+my/prereq:
+       @: Do nothing.
+do/test: my/prereq
+       : \
+         && test '$(v0)' = 'foo.sh bar.sh bar.txt' \
+         && test '$(v1)' = 'bar.sh bar.txt foo.sh' \
+         && test $(v3) = sub/libfoo.a \
+         && test '$(v4)' = 'sub/libfoo.a libfoo.a' \
+         && test $(bla) = okey-dokey \
+         && test $(bli) = okey-dokey \
+         && test $(blo) = okey-dokey \
+         && test $(blu) = okey-dokey \
+         && test $(bar1) = 6 \
+         && test $(baz1) = 7 \
+         && test $(zap1) = 8 \
+         && test $(address@hidden;by,gnu/make) = wow \
+## See automake bug#9587 .
+         && test '$(@F)' = 'test' \
+         && test '$(@D)' = 'do' \
+         && test '$(<F)' = 'prereq' \
+         && test '$(<D)' = 'my'
+END
+
+echo AC_OUTPUT >> configure.in
+
+$ACLOCAL
+$AUTOMAKE 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; }
+
+: > foo.sh
+: > bar.sh
+: > bar.txt
+
+$AUTOCONF
+./configure
+make 'do/test'
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 417e463..436e158 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -375,11 +375,8 @@ distcheck-override-infodir.test \
 distcheck-pr9579.test \
 distcheck-pr10470.test \
 dmalloc.test \
-doc-parsing-buglets-colneq-subst.test \
 doc-parsing-buglets-tabs.test \
 dollar.test \
-dollarvar.test \
-dollarvar2.test \
 double.test \
 dup2.test \
 else.test \
@@ -413,7 +410,6 @@ extra12.test \
 extra-programs-empty.test \
 extra-portability.test \
 extra-portability2.test \
-extra-portability3.test \
 extradep.test \
 extradep2.test \
 f90only.test \
@@ -440,6 +436,7 @@ gcj6.test \
 gettext.test \
 gettext2.test \
 gettext3.test \
+gmake-vars.test \
 gnumake.test \
 gnuwarn.test \
 gnuwarn2.test \
@@ -919,7 +916,6 @@ silent-lex-gcc.test \
 silent-lex-generic.test \
 silent-yacc-gcc.test \
 silent-yacc-generic.test \
-silent-nowarn.test \
 silent-configsite.test \
 silent-nested-vars.test \
 srcsub.test \
@@ -1148,7 +1144,6 @@ vala5.test \
 vala-vpath.test \
 vala-mix.test \
 vars.test \
-vars3.test \
 vartar.test \
 vartypos.test \
 vartypo2.test \
diff --git a/tests/silent-nowarn.test b/tests/silent-nowarn.test
deleted file mode 100755
index f0f5e70..0000000
--- a/tests/silent-nowarn.test
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2011 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/>.
-
-# Check that the 'silent-rules' mode suppresses the warnings for recursive
-# make variable expansions.  This should happen regardless of whether and
-# where these warnings are requested.
-
-. ./defs || Exit 1
-
-cat > configure.in <<END
-AC_INIT([$me], [1.0])
-# Yes, we repeat the warnings two times, both before and after
-# 'silent-rules'.  This is deliberate.
-AM_INIT_AUTOMAKE([gnu -Wall -Wportability-recursive
-                      silent-rules
-                      -Wall -Wportability-recursive])
-AC_CONFIG_FILES([Makefile])
-END
-
-cat > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = gnu -Wall -Wportability-recursive
-foo = $($(v)) $(x$(v)) $($(v)x) $(y$(v)z)
-END
-
-# Files required bu gnu strictness.
-touch AUTHORS ChangeLog COPYING INSTALL NEWS README THANKS
-
-$ACLOCAL
-$AUTOMAKE --gnu -Wall -Wportability-recursive
-
-:
diff --git a/tests/test-driver-custom-xfail-tests.test 
b/tests/test-driver-custom-xfail-tests.test
index 3c46237..7758097 100755
--- a/tests/test-driver-custom-xfail-tests.test
+++ b/tests/test-driver-custom-xfail-tests.test
@@ -49,8 +49,6 @@ TESTS = pass.test x1.test x2.test x3.test x4.test x5.test 
x6.test
 END
 
 cat > sub2/Makefile.am <<'END'
-AUTOMAKE_OPTIONS = -Wno-portability-recursive
-
 TEST_LOG_DRIVER = $(srcdir)/../td
 
 # XFAIL_TESTS should gracefully AC_SUBST @substitution@ and
diff --git a/tests/vars3.test b/tests/vars3.test
deleted file mode 100755
index 29dd575..0000000
--- a/tests/vars3.test
+++ /dev/null
@@ -1,72 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2010, 2011 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/>.
-
-# Check that Automake warns about variables containing spaces
-# and other non-POSIX characters.
-
-. ./defs || Exit 1
-
-cat >Makefile.am <<'EOF'
-L01 = $(shell echo *)
-L02 = $$(not an error)
-L03 = $$(this is)$${ok too}
-L04 = $(nextvariableisbad)$(addsuffix .a, $(A))
-L05 = "$(bad boy)"
-L06 = $(this:is= ok)
-L07 = ${three errors}${on this} $(long line)
-L08$(o u c h): $(wildcard *.c)
-       ${another Error}
-       echo $${ok-this is}
-L11: $(thisis) $(ok)
-       ${here}
-EOF
-
-$ACLOCAL
-# Make sure this warning is print in the `portability' category.
-$AUTOMAKE --warnings=no-error,none,portability 2>stderr \
-  || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-
-# Lines number are printed in error message.
-# Use them to make sure errors are diagnosed against the right lines.
-
-# No error expected apart from those on these lines.
-grep -v '^Makefile\.am:[145789]:' stderr | grep . && Exit 1
-
-# Now check some individual values.
-grep ':1:.*shell echo' stderr
-grep 'nextvariableisbad' stderr && Exit 1
-grep ':4:.*addsuffix' stderr
-grep ':5:.*bad boy' stderr
-grep ':7:.*three errors' stderr
-grep ':7:.*on this' stderr
-grep ':7:.*long line' stderr
-grep ':8:.*o u c h' stderr
-grep ':8:.*wildcard' stderr
-grep ':9:.*another Error' stderr
-
-$EGREP 'ok|thisis|here' stderr && Exit 1
-
-# None of these errors be diagnosed with `-Wno-portability'.
-$AUTOMAKE -Wno-portability
-
-# Likewise if we add this in the Makefile.am
-# (although this makes some difference internally: AUTOMAKE_OPTIONS is
-# processed far later).
-echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
-$AUTOMAKE
-
-:
-- 
1.7.7.3




reply via email to

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