From 7a1e38268a713776fcff894d6ef0f13c7820e401 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 16 Sep 1996 04:56:47 +0000 Subject: [PATCH] Do some typo checking --- ChangeLog | 9 +++++++++ TODO | 4 ++++ automake.in | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/ChangeLog b/ChangeLog index 83fb2dbb..e9693cb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sun Sep 15 22:45:43 1996 Tom Tromey + + * automake.in (initialize_per_input): Init content_seen. + (variable_value_as_list): Set content_seen entry. + (define_variable): Ditto. + (define_pretty_variable): Ditto. + (check_source_typos): New sub. + (generate_makefile): Call it. + Thu Sep 12 15:03:19 1996 Tom Tromey * automake.in (handle_source_transform): Removed extraneous diff --git a/TODO b/TODO index 0ae8b0b8..14508557 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,10 @@ Priorities for release: [ none ] +check for misspellings in other variables? +which ones? _LDADD _DEPENDENCIES _LIBADD +maybe more? + must at least partially rewrite dist system (to handle distributing info files, which is currently somewhat broken). diff --git a/automake.in b/automake.in index bd4e47d8..5d3117bf 100755 --- a/automake.in +++ b/automake.in @@ -435,6 +435,7 @@ sub generate_makefile &handle_gettext; &handle_libraries; &handle_programs; + &check_source_typos; &handle_scripts; # This must be run after all the sources are scanned. @@ -1131,6 +1132,20 @@ sub handle_libraries } } +# See if any _SOURCES variable were misspelled. +sub check_source_typos +{ + local ($varname); + foreach $varname (keys %contents) + { + if ($varname =~ /_SOURCES$/ && ! $content_seen{$varname}) + { + &am_line_error ($varname, + "invalid unused variable name: \`$varname'"); + } + } +} + # Handle scripts. sub handle_scripts { @@ -2982,6 +2997,7 @@ sub variable_value_as_list } else { + $content_seen{$var} = 1; foreach (split (' ', $contents{$var})) { # Handle variable substitutions. @@ -3008,6 +3024,7 @@ sub define_variable { $output_vars .= $var . ' = ' . $value . "\n"; $contents{$var} = $value; + $content_seen{$var} = 1; } } @@ -3020,6 +3037,7 @@ sub define_pretty_variable { $contents{$var} = join (' ', @value); &pretty_print ($var . ' = ', '', @value); + $content_seen{$var} = 1; } } @@ -3325,6 +3343,9 @@ sub initialize_per_input # %contents are defined. %content_lines = (); + # This holds a 1 if a particular variable was examined. + %content_seen = (); + # This holds the "relative directory" of the current Makefile.in. # Eg for src/Makefile.in, this is "src". $relative_dir = ''; -- 2.43.5