* bin/autoscan.in: Improve the comments.

(&parse_args): Drop obsolete undocumented options.
(&output_kind): Output warnings.
* lib/autoscan/functions: (dcgettext): Now trigger AM_GNU_GETTEXT.
(getwd): Trigger a warning.
This commit is contained in:
Akim Demaille 2002-09-27 07:35:39 +00:00
parent ce41e55f9e
commit 686b49d823
3 changed files with 71 additions and 40 deletions

View File

@ -1,3 +1,11 @@
2002-09-27 Akim Demaille <akim@epita.fr>
* bin/autoscan.in: Improve the comments.
(&parse_args): Drop obsolete undocumented options.
(&output_kind): Output warnings.
* lib/autoscan/functions: (dcgettext): Now trigger AM_GNU_GETTEXT.
(getwd): Trigger a warning.
2002-09-26 Akim Demaille <akim@epita.fr>
* bin/autoreconf.in: Clarify that -s is meaningless without -i.

View File

@ -43,16 +43,6 @@ my %c_keywords = map { $_ => 1}
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.
my %used = ();
# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
my %macro = ();
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
my %needed_macros = ();
my @kinds = qw (functions headers identifiers programs
makevars libraries);
@ -68,12 +58,28 @@ my %generic_macro =
my %kind_comment =
(
'functions' => 'Checks for library functions.',
'headers' => 'Checks for header files.',
'functions' => 'Checks for library functions.',
'headers' => 'Checks for header files.',
'identifiers' => 'Checks for typedefs, structures, and compiler characteristics.',
'programs' => 'Checks for programs.',
'programs' => 'Checks for programs.',
);
# $USED{KIND}{ITEM} is the list of locations where the ITEM (of KIND) was used
# in the user package.
# For instance $USED{function}{alloca} is the list of `file:line' where
# `alloca (...)' appears.
my %used = ();
# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
# Initialized from lib/autoscan/*. E.g., $MACRO{function}{alloca} contains
# the singleton AC_FUNC_ALLOCA. Some require several checks.
my %macro = ();
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
# E.g., $NEEDED_MACROS{AC_FUNC_ALLOC} the list of `file:line' containing
# `alloca (...)'.
my %needed_macros = ();
my $configure_scan = 'configure.scan';
my $log = new Autom4te::XFile ">$me.log";
@ -123,7 +129,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
# Process any command line arguments.
sub parse_args ()
{
getopt ('I|include|A|autoconf-dir|m|macrodir=s' => \@include,
getopt ('I|include=s' => \@include,
'B|prepend-include=s' => \@prepend_include);
die "$me: too many arguments
@ -162,25 +168,31 @@ sub init_tables ()
# Ignore blank lines and comments.
next
if /^\s*$/ || /^\s*\#/;
unless (/^(\S+)\s+(\S.*)$/ || /^(\S+)\s*$/)
# '<word> <macro invocation>' or...
# '<word> warn: <message>' or...
# '<word>'.
if (/^(\S+)\s+(\S.*)$/ || /^(\S+)\s*$/)
{
error "cannot parse definition in $file:\n$_";
}
my $word = $1;
my $macro = $2 || $generic_macro{$kind};
# The default macro must be explicitly listed for words
# which have a specific macros. This allows to enforce
# consistency checks.
if (!defined $2 && exists $macro{$kind}{$word})
{
warn ("$file:$.: "
. "ignoring implicit call to the generic macro for $word\n");
$tables_are_consistent = 0;
}
else
{
push @{$macro{$kind}{$word}}, $macro;
my $word = $1;
my $macro = $2 || $generic_macro{$kind};
# The default macro must be explicitly listed for words
# which have a specific macros. This allows to enforce
# consistency checks.
if (!defined $2 && exists $macro{$kind}{$word})
{
warn ("$file:$.: "
. "ignoring implicit call to the generic macro for $word\n");
$tables_are_consistent = 0;
}
else
{
push @{$macro{$kind}{$word}}, $macro;
}
next;
}
error "cannot parse definition in $file:\n$_";
}
$table->close;
}
@ -200,6 +212,7 @@ sub used ($$;$)
push (@{$used{$kind}{$word}}, $where);
}
## ----------------------- ##
## Scanning source files. ##
## ----------------------- ##
@ -436,7 +449,15 @@ sub output_kind ($$)
# already printed, and remember these macros are needed.
foreach my $macro (@{$macro{$kind}{$word}})
{
if (exists $generic_macro{$kind}
if ($macro =~ /^warn:\s+(.*)/)
{
my $message = $1;
foreach my $location (@{$used{$kind}{$word}})
{
warn "$location: warning: $message\n";
}
}
elsif (exists $generic_macro{$kind}
&& $macro eq $generic_macro{$kind})
{
push (@have, $word);

View File

@ -21,9 +21,10 @@
alloca AC_FUNC_ALLOCA
bcmp AC_HEADER_STDC
bcopy AC_HEADER_STDC
bzero AC_HEADER_STDC
bzero AC_CHECK_FUNCS
bzero AC_HEADER_STDC
chown AC_FUNC_CHOWN
dcgettext AM_GNU_GETTEXT
error AC_FUNC_ERROR_AT_LINE
error_at_line AC_FUNC_ERROR_AT_LINE
fnmatch AC_FUNC_FNMATCH
@ -37,16 +38,16 @@ index AC_HEADER_STDC
ioctl AC_PROG_GCC_TRADITIONAL
lstat AC_FUNC_LSTAT
major AC_HEADER_MAJOR
malloc AC_FUNC_MALLOC
makedev AC_HEADER_MAJOR
memchr AC_HEADER_STDC
malloc AC_FUNC_MALLOC
memchr AC_CHECK_FUNCS
memchr AC_HEADER_STDC
memcmp AC_FUNC_MEMCMP
memcpy AC_HEADER_STDC
memmove AC_HEADER_STDC
memmove AC_CHECK_FUNCS
memset AC_HEADER_STDC
memmove AC_HEADER_STDC
memset AC_CHECK_FUNCS
memset AC_HEADER_STDC
minor AC_HEADER_MAJOR
mktime AC_FUNC_MKTIME
mmap AC_FUNC_MMAP
@ -62,14 +63,17 @@ strerror_r AC_FUNC_STRERROR_R
strftime AC_FUNC_STRFTIME
strnlen AC_FUNC_STRNLEN
strtod AC_FUNC_STRTOD
utime AC_FUNC_UTIME_NULL
utime AC_CHECK_FUNCS
utime AC_FUNC_UTIME_NULL
vfork AC_FUNC_FORK
vfprintf AC_FUNC_VPRINTF
vprintf AC_FUNC_VPRINTF
vsprintf AC_FUNC_VPRINTF
wait3 AC_FUNC_WAIT3
# Functions we should no longer use.
getwd warn: getwd is depecrated, use getcwd instead
# Others, checked with AC_CHECK_FUNCS.
__argz_count
__argz_next
@ -80,7 +84,6 @@ alarm
atexit
btowc
clock_gettime
dcgettext
doprnt
dup2
endgrent
@ -106,7 +109,6 @@ getpass
getspnam
gettimeofday
getusershell
getwd
hasmntopt
inet_ntoa
isascii