GNU bug report logs - #14560
C Compilation variables present in output Makefiles unconditionally

Previous Next

Package: automake;

Reported by: Ralf Corsepius <ralf.corsepius <at> rtems.org>

Date: Wed, 5 Jun 2013 10:06:01 UTC

Severity: minor

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #33 received at 14560 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: 14560 <at> debbugs.gnu.org, Ralf Corsepius <ralf.corsepius <at> rtems.org>
Subject: [PATCH 2/2] lang, suffix rules: don't require C stuff needlessly
Date: Wed, 12 Jun 2013 12:26:17 +0200
This change fixes automake bug#14560: when two or more user-defined suffix
rules were present in a single Makefile.am, automake would needlessly
include definition of some make variables related to C compilation in the
generated Makefile.in.

* automake.in (handle_languages): Fix logic to decide whether or not to
include definitions of C compilation related variables in the generated
Makefile.in: instead of doing so when two or more user-defined suffix
rules are seen (which is a completely bogus criterion), do so when two
or more compiled languages are used.
* lib/Automake/Rule.pm (suffix_rules_count): Remove as no longer used.
(@EXPORT): Adjust.
* t/list-of-tests.mk (XFAIL_TESTS): No longer list the test script
'suffix-extra-c-stuff-pr14560.sh', which now passes.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini <at> gmail.com>
---
 NEWS                 | 11 +++++++++++
 automake.in          |  9 +++++----
 lib/Automake/Rule.pm | 15 +--------------
 t/list-of-tests.mk   |  1 -
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/NEWS b/NEWS
index d540aab..a6f0953 100644
--- a/NEWS
+++ b/NEWS
@@ -91,6 +91,17 @@
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+New in 1.13.4:
+
+* Bugs fixed:
+
+  - Fix a minor regression introduced in Automake 1.13.3: when two or more
+    user-defined suffix rules were present in a single Makefile.am,
+    automake would needlessly include definition of some make variables
+    related to C compilation in the generated Makefile.in (bug#14560).
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 New in 1.13.3:
 
 * Documentation fixes:
diff --git a/automake.in b/automake.in
index 63d5bdf..835d3bd 100644
--- a/automake.in
+++ b/automake.in
@@ -1572,10 +1572,11 @@ sub handle_languages
     # If the project is entirely C++ or entirely Fortran 77 (i.e., 1
     # suffix rule was learned), don't bother with the C stuff.  But if
     # anything else creeps in, then use it.
-    $needs_c = 1
-      if $need_link || suffix_rules_count > 1;
-
-    if ($needs_c)
+    my @languages_seen = map { $languages{$extension_map{$_}}->name }
+                             (keys %extension_seen);
+    @languages_seen = uniq (@languages_seen);
+    $needs_c = 1 if @languages_seen > 1;
+    if ($need_link || $needs_c)
       {
 	&define_compiler_variable ($languages{'c'})
 	  unless defined $done{$languages{'c'}};
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index 7fe6474..a28a78d 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -29,8 +29,7 @@ use Automake::DisjConditions;
 require Exporter;
 use vars '@ISA', '@EXPORT', '@EXPORT_OK';
 @ISA = qw/Automake::Item Exporter/;
-@EXPORT = qw (reset register_suffix_rule suffix_rules_count
-              next_in_suffix_chain
+@EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
 	      suffixes rules $KNOWN_EXTENSIONS_PATTERN
 	      depend %dependencies %actions register_action
 	      accept_extensions
@@ -465,18 +464,6 @@ sub register_suffix_rule ($$$)
     }
 }
 
-=item C<$count = suffix_rules_count>
-
-Return the number of suffix rules added while processing the current
-F<Makefile> (excluding predefined suffix rules).
-
-=cut
-
-sub suffix_rules_count ()
-{
-  return (scalar keys %_suffix_rules) - (scalar keys %_suffix_rules_builtin);
-}
-
 =item C<@list = suffixes>
 
 Return the list of known suffixes.
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index f2eb648..007094f 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -42,7 +42,6 @@ t/remake-timing-bug-pr8365.sh \
 t/lex-subobj-nodep.sh \
 t/subobj-indir-pr13928.sh \
 t/subobj-vpath-pr13928.sh \
-t/suffix-extra-c-stuff-pr14560.sh \
 t/remake-am-pr10111.sh \
 t/remake-m4-pr10111.sh \
 $(perl_fake_XFAIL_TESTS)
-- 
1.8.3.rc3.260.g1462b67





This bug report was last modified 11 years and 342 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.