From: Tom Tromey Date: Sat, 16 Nov 1996 05:35:55 +0000 (+0000) Subject: Better de-ansification handling X-Git-Tag: Release-1-1h~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfdf7f19a397071b60ee57de1fa97a5bce58d38e;p=thirdparty%2Fautomake.git Better de-ansification handling --- diff --git a/ChangeLog b/ChangeLog index 32ab1cebc..9f34d08f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Fri Nov 15 18:58:04 1996 Tom Tromey + + * automake.in (initialize_per_input): Init de_ansi_objects. + (handle_single_transform_list): Error if extension unrecognized. + Set elements of de_ansi_objects. + (get_object_extension): Don't push ANSI2KNR onto @all. + (handle_yacc_lex_cxx): Put ANSI2KNR into dependency of all ._o + files. + (pretty_print_internal): Initialize $bol depending on the column. + Fri Nov 15 16:22:15 1996 Gordon Matzigkeit * library.am: Fixed references to LIBRARY according to new scheme. diff --git a/TODO b/TODO index f5f613f5b..4299262ff 100644 --- a/TODO +++ b/TODO @@ -9,10 +9,6 @@ Priorities for release: * clean up source directory by moving stuff into subdirs -!! foo_LIBRARIES = @JOE@ -> _LIBFILES is wrong - [ have implemented temporary fix, but something better must be done - probably do Gord's idea ] - !! EXTRA_FOO should not be allowed to contain automake interpolations the whole point of this variable is so automake can statically know... This should probably be true for all EXTRA_ variables diff --git a/automake.in b/automake.in index c43d0d794..d00ae1b90 100755 --- a/automake.in +++ b/automake.in @@ -654,7 +654,6 @@ sub get_object_extension # Substitution from AM_C_PROTOTYPES. This makes it be # built only when necessary. &define_configure_variable ('ANSI2KNR'); - push (@all, '$(ANSI2KNR)'); } $output_rules .= &file_contents ('compile-kr'); @@ -759,6 +758,17 @@ sub handle_yacc_lex_cxx } } + # + # Handle some ansi2knr cleanup. + # + if (defined $options{'ansi2knr'} && keys %de_ansi_objects) + { + # Make all ._o files depend on ansi2knr. Use a sneaky little + # hack to make it print nicely. + &pretty_print_rule ('', '', (keys %de_ansi_objects, + ':', '$(ANSI2KNR)')); + } + # # Last, handle some C cleanup. # @@ -865,22 +875,29 @@ sub handle_single_transform_list { # FORTRAN support. FIXME: not finished. } - else + elsif (s/\.[clysmM]$/._o/) { - # C, yacc, and lex need special $obj extension, for - # de-ansification. Hopefully someday this will go - # away. - s/\.[cly]$/$obj/g; + # .c is C. .l is lex. .y is yacc. .s is assembly. + # .M is Objective-C++. .m is Objective-C. - # .s is assembly. .M is Objective-C++. .m is - # Objective-C. - s/\.[smM]$/$obj/g; + # Note: first we rewrite (eg) foo.c to foo._o and push + # the file onto the list of objects that require + # ansi2knr. Then we rewrite ._o to $obj; $obj can be + # simply `.o' if deansification is not really + # required. + $de_ansi_objects{$_} = 1; + s/\._o$/$obj/; # FIXME: of course, this should only happen for C # source. The multi-language support must really be # cleaned up more globally. $seen_c_source = 1; } + else + { + # FIXME include line number in error. + &am_error ("file \`$_' has unrecognized extension"); + } push (@result, $_); @@ -3279,7 +3296,7 @@ sub pretty_print_internal local ($fill_length) = length ($fill); $fill_length += 7 * ($fill =~ tr/\t/\t/d); - local ($bol) = 0; + local ($bol) = ($head eq ''); foreach (@values) { # "71" because we also print a space. @@ -3846,6 +3863,10 @@ sub initialize_per_input # This is a list of all targets to run during "make dist". @dist_targets = (); + + # Keys in this hash are the names of ._o files which must depend + # on ansi2knr. Ugh. + %de_ansi_objects = (); } diff --git a/tests/ChangeLog b/tests/ChangeLog index 7b6527a9b..52c746123 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,7 @@ Fri Nov 15 00:09:18 1996 Tom Tromey + * ansi2.test: New file. + * libfiles.test: Removed (obsolete). * libobj.test, canon4.test, libobj2.test, alllib.test, diff --git a/tests/Makefile.am b/tests/Makefile.am index 4263d4df4..be82523e5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,7 +10,7 @@ target.test extra.test noinst.test instman.test mkinstall.test auxdir.test \ canon3.test mdate2.test subdir.test backsl.test package.test number.test \ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinst2.test texinfo2.test ansi.test depacl.test depacl2.test \ -error.test colon.test vtexi2.test tags.test comment.test \ +error.test colon.test vtexi2.test tags.test comment.test ansi2.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 05c2ceb3a..7e5bf2dfd 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -49,7 +49,7 @@ target.test extra.test noinst.test instman.test mkinstall.test auxdir.test \ canon3.test mdate2.test subdir.test backsl.test package.test number.test \ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinst2.test texinfo2.test ansi.test depacl.test depacl2.test \ -error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ +error.test colon.test vtexi2.test tags.test comment.test ansi2.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ diff --git a/tests/ansi2.test b/tests/ansi2.test new file mode 100755 index 000000000..c823822bd --- /dev/null +++ b/tests/ansi2.test @@ -0,0 +1,22 @@ +#! /bin/sh + +# Test to make sure ansi2knr built at the right time. + +. $srcdir/defs || exit 1 + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = ansi2knr +bin_PROGRAMS = joe +END + +cat >> configure.in << 'END' +AC_PROG_CC +AM_C_PROTOTYPES +END + +: > ansi2knr.c +: > ansi2knr.1 + +$AUTOMAKE || exit 1 + +grep '^joe._o.*:.*ANSI2KNR' Makefile.in