From 98fab1246b31bc4eb5d83ac7524d1fd126d0e416 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 13 Jun 2011 21:27:35 +0200 Subject: [PATCH] ansi2knr: deprecate, it will go away in the next major release * doc/automake.texi: Loudly and repeatedly state that the old de-ANSI-fication features are now deprecated and will be removed in the next major Automake release. Other related adjustments. * lib/Automake/Options.pm (_process_option_list ): Give a warning in the `obsolete' category when the `ansi2knr' option is used. * m4/protos.m4 (AM_C_PROTOTYPES): Deprecate this macro: a warning in the `obsolete' category will be emitted it if is used. * tests/ansi2knr-deprecation.test: New test. * tests/Makefile.am (TESTS): Update. * tests/ansi.test: Adjust, by calling autoconf and/or automake with the `-Wno-obsolete' flag. * tests/ansi10.test: Likewise. * tests/ansi2.test: Likewise. * tests/ansi3.test: Likewise. * tests/ansi3b.test: Likewise. * tests/ansi4.test: Likewise. * tests/ansi5.test: Likewise. * tests/ansi6.test: Likewise. * tests/ansi7.test: Likewise. * tests/ansi8.test: Likewise. * tests/ansi9.test: Likewise. * tests/cxxansi.test: Likewise. * tests/libobj8.test: Likewise. * NEWS: Update about the future planned backward-incompatibility due to the removal of de-ANSI-fication feature. --- ChangeLog | 29 ++++++++++++++ NEWS | 5 +++ doc/automake.texi | 57 +++++++++++++-------------- lib/Automake/Options.pm | 4 ++ m4/protos.m4 | 2 + tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/ansi.test | 4 +- tests/ansi10.test | 4 +- tests/ansi2.test | 2 +- tests/ansi2knr-deprecation.test | 69 +++++++++++++++++++++++++++++++++ tests/ansi3.test | 4 +- tests/ansi3b.test | 4 +- tests/ansi4.test | 2 +- tests/ansi5.test | 4 +- tests/ansi6.test | 4 +- tests/ansi7.test | 4 +- tests/ansi8.test | 2 +- tests/ansi9.test | 4 +- tests/cxxansi.test | 2 +- tests/libobj8.test | 2 +- 21 files changed, 158 insertions(+), 52 deletions(-) create mode 100755 tests/ansi2knr-deprecation.test diff --git a/ChangeLog b/ChangeLog index 917c2d4d3..fb96549a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2011-06-14 Stefano Lattarini + + ansi2knr: deprecate, it will go away in the next major release + * doc/automake.texi: Loudly and repeatedly state that the old + de-ANSI-fication features are now deprecated and will be removed + in the next major Automake release. Other related adjustments. + * lib/Automake/Options.pm (_process_option_list ): Give a warning + in the `obsolete' category when the `ansi2knr' option is used. + * m4/protos.m4 (AM_C_PROTOTYPES): Deprecate this macro: a warning + in the `obsolete' category will be emitted it if is used. + * tests/ansi2knr-deprecation.test: New test. + * tests/Makefile.am (TESTS): Update. + * tests/ansi.test: Adjust, by calling autoconf and/or automake + with the `-Wno-obsolete' flag. + * tests/ansi10.test: Likewise. + * tests/ansi2.test: Likewise. + * tests/ansi3.test: Likewise. + * tests/ansi3b.test: Likewise. + * tests/ansi4.test: Likewise. + * tests/ansi5.test: Likewise. + * tests/ansi6.test: Likewise. + * tests/ansi7.test: Likewise. + * tests/ansi8.test: Likewise. + * tests/ansi9.test: Likewise. + * tests/cxxansi.test: Likewise. + * tests/libobj8.test: Likewise. + * NEWS: Update about the future planned backward-incompatibility + due to the removal of de-ANSI-fication feature. + 2011-06-19 Stefano Lattarini docs: primary/prefix combination "pkglib_PROGRAMS" is now invalid diff --git a/NEWS b/NEWS index fd7dd53d1..29c552bbb 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ New in 1.11.0a: +* WARNING: Future backward-incompatibilities! + + - The Automake support for automatic de-ANSI-fication will be removed in + the next major Automake release (1.12). + * Miscellaneous changes: - The `lzma' compression scheme and associated automake option `dist-lzma' diff --git a/doc/automake.texi b/doc/automake.texi index 4209c0711..52e8cc3ad 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -232,7 +232,7 @@ Building Programs and Libraries * Java Support:: Compiling Java sources * Vala Support:: Compiling Vala sources * Support for Other Languages:: Compiling other languages -* ANSI:: Automatic de-ANSI-fication (obsolete) +* ANSI:: Automatic de-ANSI-fication (deprecated, soon to be removed) * Dependencies:: Automatic dependency tracking * EXEEXT:: Support for executable extensions @@ -2226,8 +2226,9 @@ source in case you need more recent versions. @table @code @item ansi2knr.c @itemx ansi2knr.1 -These two files are used for de-ANSI-fication support (obsolete -@pxref{ANSI}). +These two files are used for de-ANSI-fication support (they are +deprecated now, and @emph{will be removed} in the next major Automake +release; @pxref{ANSI}). @item compile This is a wrapper for compilers that do not accept options @option{-c} @@ -2447,20 +2448,8 @@ false.o: true.c $(COMPILE) -DEXIT_CODE=1 -c true.c && mv true.o false.o @end example -Also, these explicit rules do not work if the obsolete de-ANSI-fication feature -is used (@pxref{ANSI}). Supporting de-ANSI-fication requires a little -more work: - -@example -true_.o: true_.c false_.o - $(COMPILE) -DEXIT_CODE=0 -c true_.c - -false_.o: true_.c - $(COMPILE) -DEXIT_CODE=1 -c true_.c && mv true_.o false_.o -@end example - As it turns out, there is also a much easier way to do this same task. -Some of the above techniques are useful enough that we've kept the +Some of the above technique is useful enough that we've kept the example in the manual. However if you were to build @code{true} and @code{false} in real life, you would probably use per-program compilation flags, like so: @@ -2476,10 +2465,9 @@ true_CPPFLAGS = -DEXIT_CODE=0 @end example In this case Automake will cause @file{true.c} to be compiled twice, -with different flags. De-ANSI-fication will work automatically. In -this instance, the names of the object files would be chosen by -automake; they would be @file{false-true.o} and @file{true-true.o}. -(The name of the object files rarely matters.) +with different flags. In this instance, the names of the object files +would be chosen by automake; they would be @file{false-true.o} and +@file{true-true.o}. (The name of the object files rarely matters.) @node Invoking Automake @@ -3033,8 +3021,8 @@ this way, e.g., @code{AC_PATH_XTRA} defines @code{X_CFLAGS} and if @code{AC_PATH_XTRA} is called. @item AM_C_PROTOTYPES -This is required when using the obsolete de-ANSI-fication feature; see -@ref{ANSI}. +This is required when using the deprecated de-ANSI-fication feature; see +@ref{ANSI}. @emph{It will be removed} in the next major Automake release. @item AM_CONDITIONAL This introduces an Automake conditional (@pxref{Conditionals}). @@ -4010,8 +3998,10 @@ Autoconf Manual}). Check to see if function prototypes are understood by the compiler. If so, define @samp{PROTOTYPES} and set the output variables @code{U} and @code{ANSI2KNR} to the empty string. Otherwise, set @code{U} to -@samp{_} and @code{ANSI2KNR} to @samp{./ansi2knr}. Automake uses these -values to implement the obsolete de-ANSI-fication feature. +@samp{_} and @code{ANSI2KNR} to @samp{./ansi2knr}. Automake used these +values to implement the deprecated de-ANSI-fication feature; however, +support for @emph{that feature will be removed} in the next major Automake +release, and then @emph{these macros and variables will go away as well}. @item AM_CONFIG_HEADER @acindex AM_CONFIG_HEADER @@ -4611,7 +4601,7 @@ to build programs and libraries. * Java Support:: Compiling Java sources * Vala Support:: Compiling Vala sources * Support for Other Languages:: Compiling other languages -* ANSI:: Automatic de-ANSI-fication (obsolete) +* ANSI:: Automatic de-ANSI-fication (deprecated, soon to be removed) * Dependencies:: Automatic dependency tracking * EXEEXT:: Support for executable extensions @end menu @@ -6760,13 +6750,14 @@ suffix rule handling (@pxref{Suffixes}). @node ANSI -@section Automatic de-ANSI-fication +@section Automatic de-ANSI-fication (deprecated, soon to be removed) @cindex de-ANSI-fication, defined -The features described in this section are obsolete; you should not -used any of them in new code, and they may be withdrawn in future -Automake releases. +@emph{The features described in this section are deprecated; you must +not use any of them in new code, and remove their use from older but +still maintained code: they will be withdrawn in the next major +Automake release.} When the C language was standardized in 1989, there was a long transition period where package developers needed to worry about @@ -9063,11 +9054,15 @@ implies options @option{readme-alpha} and @option{check-news}. @itemx @option{@var{path}/ansi2knr} @cindex Option, @option{ansi2knr} @opindex ansi2knr -Turn on the obsolete de-ANSI-fication feature. @xref{ANSI}. If preceded by a +Turn on the deprecated de-ANSI-fication feature (@xref{ANSI}). Note +that that feature and this option @emph{will be removed} in the next +major Automake release. + +If preceded by a path, the generated @file{Makefile.in} will look in the specified directory to find the @file{ansi2knr} program. The path should be a relative path to another directory in the same distribution (Automake -currently does not check this). +does not check this). @item @option{check-news} @cindex Option, @option{check-news} diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 9543aa592..b7ff3d1f5 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -252,6 +252,10 @@ sub _process_option_list (\%$@) } elsif (/^(.*\/)?ansi2knr$/) { + # This feature is deprecated, will be removed in the next + # Automake major release. + msg 'obsolete', $where, + "automatic de-ANSI-fication support is deprecated\n"; # An option like "../lib/ansi2knr" is allowed. With no # path prefix, we assume the required programs are in this # directory. We save the actual option for later. diff --git a/m4/protos.m4 b/m4/protos.m4 index 427193b93..f710293e9 100644 --- a/m4/protos.m4 +++ b/m4/protos.m4 @@ -13,6 +13,8 @@ AC_DEFUN([AM_C_PROTOTYPES], [AC_REQUIRE([AC_C_PROTOTYPES]) +AC_DIAGNOSE([obsolete], + [$0: automatic de-ANSI-fication support is deprecated]) if test "$ac_cv_prog_cc_stdc" != no; then U= ANSI2KNR= else diff --git a/tests/Makefile.am b/tests/Makefile.am index bd3f99c25..28196f896 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -89,6 +89,7 @@ amassign.test \ ammissing.test \ amopt.test \ amsubst.test \ +ansi2knr-deprecation.test \ ansi.test \ ansi2.test \ ansi3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b81096374..5ca3f6a16 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -360,6 +360,7 @@ amassign.test \ ammissing.test \ amopt.test \ amsubst.test \ +ansi2knr-deprecation.test \ ansi.test \ ansi2.test \ ansi3.test \ diff --git a/tests/ansi.test b/tests/ansi.test index 7795f48d2..0aa000e43 100755 --- a/tests/ansi.test +++ b/tests/ansi.test @@ -42,8 +42,8 @@ END : > ansi2knr.1 $ACLOCAL -$AUTOCONF -$AUTOMAKE +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete ./configure diff --git a/tests/ansi10.test b/tests/ansi10.test index 88b8618f6..4ff2c8633 100755 --- a/tests/ansi10.test +++ b/tests/ansi10.test @@ -55,8 +55,8 @@ main (int argc, char **argv) END $ACLOCAL -$AUTOCONF -$AUTOMAKE -a +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete -a # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 diff --git a/tests/ansi2.test b/tests/ansi2.test index 77ca2c616..504c8c39a 100755 --- a/tests/ansi2.test +++ b/tests/ansi2.test @@ -35,6 +35,6 @@ END : > ansi2knr.1 $ACLOCAL -$AUTOMAKE +$AUTOMAKE -Wno-obsolete grep '^all[-a-z]*:.*ANSI2KNR' Makefile.in diff --git a/tests/ansi2knr-deprecation.test b/tests/ansi2knr-deprecation.test new file mode 100755 index 000000000..543d9c62f --- /dev/null +++ b/tests/ansi2knr-deprecation.test @@ -0,0 +1,69 @@ +#! /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 . + +# Check that the use of automatic de-ANSI-fication feature is deprecated. +# That feature will be removed in the next major Automake release. + +. ./defs || Exit 1 + +set -e + +warn_rx='automatic de-ANSI-fication.*deprecated' + +cat >> configure.in <<'END' +AC_PROG_CC +AM_C_PROTOTYPES +END + +$ACLOCAL + +$AUTOCONF -Wall -Werror -Wno-obsolete +$AUTOCONF -Wnone -Wobsolete -Werror 2>stderr && { cat stderr >&2; Exit 1; } +cat stderr >&2 +grep "^configure\\.in:5:.* AM_C_PROTOTYPES:.*$warn_rx" stderr + +sed '/AM_C_PROTOTYPES/d' configure.in > config.stub +diff configure.in config.stub && fatal_ "failed to edit configure.in" +rm -f configure.in + +cat > Makefile.stub <<'END' +ANSI2KNR = : +U = +END + +for opt in ansi2knr lib/ansi2knr; do + # ansi2knr option in Makefile.am + cp config.stub configure.in + cp Makefile.stub Makefile.am + echo "AUTOMAKE_OPTIONS = $opt" >> Makefile.am + cat Makefile.am # For debugging. + $AUTOMAKE -Wno-obsolete + AUTOMAKE_fails + grep "^Makefile\.am:3:.*$warn_rx" stderr + AUTOMAKE_fails -Wnone -Wobsolete + grep "^Makefile\.am:3:.*$warn_rx" stderr + # ansi2knr option in configure.in + cp Makefile.stub Makefile.am + sed "s|^\\(AM_INIT_AUTOMAKE\\).*|\1([$opt])|" config.stub > configure.in + cat configure.in # For debugging. + $AUTOMAKE -Wno-obsolete + AUTOMAKE_fails + grep "^configure\.in:2:.*$warn_rx" stderr + AUTOMAKE_fails -Wnone -Wobsolete + grep "^configure\.in:2:.*$warn_rx" stderr +done + +: diff --git a/tests/ansi3.test b/tests/ansi3.test index e1e0c4297..22ef48504 100755 --- a/tests/ansi3.test +++ b/tests/ansi3.test @@ -51,8 +51,8 @@ export CFLAGS # We use gcc and not gcc -traditional as the latter fails on some # Linux boxes (Red Hat 5.1 in particular). $ACLOCAL -$AUTOCONF -$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete -a 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'Makefile.am:1:.*ansi2knr\.c' stderr CC='gcc' ./configure diff --git a/tests/ansi3b.test b/tests/ansi3b.test index ad222ffe2..068878174 100755 --- a/tests/ansi3b.test +++ b/tests/ansi3b.test @@ -52,8 +52,8 @@ export CFLAGS # We use gcc and not gcc -traditional as the latter fails on some # Linux boxes (Red Hat 5.1 in particular). $ACLOCAL -$AUTOCONF -$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete -a 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'configure.in:2:.*ansi2knr\.1' stderr CC='gcc' ./configure diff --git a/tests/ansi4.test b/tests/ansi4.test index 63250a9ec..0c0d33949 100755 --- a/tests/ansi4.test +++ b/tests/ansi4.test @@ -37,6 +37,6 @@ END : > hello.c $ACLOCAL -$AUTOMAKE +$AUTOMAKE -Wno-obsolete $FGREP 'ansi2knr.$(' Makefile.in diff --git a/tests/ansi5.test b/tests/ansi5.test index 2652cb7ab..d152be012 100755 --- a/tests/ansi5.test +++ b/tests/ansi5.test @@ -66,8 +66,8 @@ END set -e $ACLOCAL -$AUTOCONF -$AUTOMAKE -a +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete -a # Ignore user CFLAGS. CFLAGS= export CFLAGS diff --git a/tests/ansi6.test b/tests/ansi6.test index 10196ea12..691614dd9 100755 --- a/tests/ansi6.test +++ b/tests/ansi6.test @@ -61,8 +61,8 @@ END set -e $ACLOCAL -$AUTOCONF -$AUTOMAKE -a +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete -a # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 diff --git a/tests/ansi7.test b/tests/ansi7.test index e97f51744..9eae26bf6 100755 --- a/tests/ansi7.test +++ b/tests/ansi7.test @@ -63,8 +63,8 @@ END set -e $ACLOCAL -$AUTOCONF -$AUTOMAKE -a +$AUTOCONF -Wno-obsolete +$AUTOMAKE -Wno-obsolete -a # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 diff --git a/tests/ansi8.test b/tests/ansi8.test index 33f17dca5..bcf99b14f 100755 --- a/tests/ansi8.test +++ b/tests/ansi8.test @@ -26,5 +26,5 @@ bin_PROGRAMS = hello END $ACLOCAL -AUTOMAKE_fails -a +AUTOMAKE_fails -Wno-obsolete -a grep AM_C_PROTOTYPES stderr diff --git a/tests/ansi9.test b/tests/ansi9.test index 4eb182074..ab78ddacf 100755 --- a/tests/ansi9.test +++ b/tests/ansi9.test @@ -50,8 +50,8 @@ mkdir sub cp loadavg.c sub/sub.c $ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing -Wno-override +$AUTOCONF -Wno-obsolete +$AUTOMAKE --add-missing -Wno-override -Wno-obsolete $FGREP 'loadavg-loadavg$U.o: loadavg$U.c' Makefile.in # The following rule should not exist, because the diff --git a/tests/cxxansi.test b/tests/cxxansi.test index 8bbe9b278..9d6fd6e11 100755 --- a/tests/cxxansi.test +++ b/tests/cxxansi.test @@ -39,7 +39,7 @@ END : > jane.C $ACLOCAL -$AUTOMAKE +$AUTOMAKE -Wno-obsolete $FGREP 'jane$U' Makefile.in && Exit 1 $FGREP 'doe$U' Makefile.in diff --git a/tests/libobj8.test b/tests/libobj8.test index c06746bef..206bca6e6 100755 --- a/tests/libobj8.test +++ b/tests/libobj8.test @@ -45,6 +45,6 @@ END : > ansi2knr.c $ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$AUTOMAKE -Wno-obsolete || Exit 1 grep 'strsignal_.c:' Makefile.in -- 2.47.2