automake-patches
[Top][All Lists]
Advanced

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

FYI: warn about `:=' (yet another portability warning)


From: Alexandre Duret-Lutz
Subject: FYI: warn about `:=' (yet another portability warning)
Date: 08 Sep 2002 21:24:36 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

I'm checking this in.

2002-09-08  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (macro_define): Warn about `:=' assignments.
        * tests/colneq.test: Check for this warning.
 
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1344
diff -u -r1.1344 automake.in
--- automake.in 25 Aug 2002 20:45:50 -0000      1.1344
+++ automake.in 8 Sep 2002 19:25:48 -0000
@@ -6176,6 +6176,13 @@
        "$var: variable names starting with `_' are not portable")
     if $var =~ /^_/;
 
+  # `:='-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
+  # conditional assignments.
+  msg ('portability', $where, "`:='-style assignments are not portable")
+    if $type eq ':';
+
   check_variable_expansions ($value, $where);
 
   $cond ||= 'TRUE';
Index: tests/colneq.test
===================================================================
RCS file: /cvs/automake/automake/tests/colneq.test,v
retrieving revision 1.4
diff -u -r1.4 colneq.test
--- tests/colneq.test   8 Sep 2002 13:07:55 -0000       1.4
+++ tests/colneq.test   8 Sep 2002 19:26:14 -0000
@@ -18,15 +18,22 @@
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# Test that := definitions work.
+# Test that := definitions produce warnings, but otherwise work.
 
 . ./defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = -Wno-portability
 ICONS := $(wildcard *.xbm)
 data_DATA = $(ICONS)
 END
 
-$ACLOCAL || exit 1
+$ACLOCAL
+$AUTOMAKE 2> stderr && exit 1
+cat stderr
+grep ':=.*not portable' stderr
+
+echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
 $AUTOMAKE
+grep 'ICONS :=' Makefile.in

-- 
Alexandre Duret-Lutz





reply via email to

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