* bin/autoscan.in (%c_keywords): Build it at top level.

Map to 1 in order to simplify its uses.
This commit is contained in:
Akim Demaille 2001-11-26 10:53:00 +00:00
parent 32e1426355
commit 4f944b43d5
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2001-11-26 Akim Demaille <akim@epita.fr>
* bin/autoscan.in (%c_keywords): Build it at top level.
Map to 1 in order to simplify its uses.
2001-11-26 Akim Demaille <akim@epita.fr>
* bin/autoscan.in (&scan_c_file, &scan_sh_file, &scan_makefile):

View File

@ -35,7 +35,13 @@ use File::Basename;
use File::Find;
use strict;
use vars qw(@cfiles @makefiles @shfiles %c_keywords %printed);
use vars qw(@cfiles @makefiles @shfiles %printed);
# The list of C keywords.
my %c_keywords = map { $_ => 1}
qw (int char float double struct union long short unsigned
auto extern register typedef static goto return sizeof break
continue if else for do while switch case default);
# $USED{KIND}{ITEM} is set if ITEM is used in the program.
# It is set to its list of locations.
@ -138,13 +144,6 @@ sub init_tables ()
# ANSI C, GNU C, and C++ keywords can introduce portability problems,
# so don't ignore them.
foreach (qw (int char float double struct union long short unsigned
auto extern register typedef static goto return sizeof break
continue if else for do while switch case default))
{
$c_keywords{$_} = 0;
}
# The data file format supports only one line of macros per function.
# If more than that is required for a common portability problem,
# a new Autoconf macro should probably be written for that case,
@ -260,12 +259,12 @@ sub scan_c_file ($)
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
{
used ('functions', $1)
if !defined $c_keywords{$1};
if !$c_keywords{$1};
}
while (s/\b([a-zA-Z_]\w*)\b/ /)
{
used ('identifiers', $1)
if !defined $c_keywords{$1};
if !$c_keywords{$1};
}
}