From: Martin Mares Date: Tue, 28 Jan 2014 16:02:42 +0000 (+0100) Subject: API: Introduced exceptions for common mistakes of the symbol mapper X-Git-Tag: v5.99~17 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ff7f126077850f9a193b4e4369dbc35f0ce81b12;p=libucw.git API: Introduced exceptions for common mistakes of the symbol mapper --- diff --git a/tools/map-symbols b/tools/map-symbols index bb82a946..94d3016d 100755 --- a/tools/map-symbols +++ b/tools/map-symbols @@ -4,12 +4,24 @@ use common::sense; +sub symbol { + my ($sym) = @_; + return if $sym =~ m{^(ucw|ucwlib)_}; + print "$sym\n"; +} + sub parse { my ($file) = @_; print "# $file\n"; open my $f, '<', $file or die; while (<$f>) { chomp; + # Interpret special comments + m{// NOAPI} and next; + if (m{// API: (\w+)}) { + print "$1\n"; + next; + } # Find things which look like top-level declarations s{//.*}{}; s{/\*.*}{}; @@ -32,9 +44,9 @@ sub parse { if (m{^extern [^,]*(\s+\**\w+(,\s+\**\w+)*);}) { my $x = $1; $x =~ s{[,*]}{}g; - print join("\n", grep { !/^$/ } split /\s+/, $x), "\n"; + symbol $_ for grep { !/^$/ } split /\s+/, $x; } elsif (m{( |\*)(\w+)\(}) { - print "$2\n"; + symbol($2); } else { print "??? $_\n"; } diff --git a/ucw/lib.h b/ucw/lib.h index 302f19ed..9892d972 100644 --- a/ucw/lib.h +++ b/ucw/lib.h @@ -155,7 +155,7 @@ void vdie(const char *fmt, va_list args) NONRET; /** va_list version of die() * extern char *log_title; /** An optional log message title. Set to program name by log_init(). **/ extern int log_pid; /** An optional PID printed in each log message. Set to 0 if it shouldn't be logged. **/ -extern void (*log_die_hook)(void); /** An optional function called just before die() exists. **/ +extern void (*log_die_hook)(void); /** An optional function called just before die() exists. **/ // API: log_die_hook void log_init(const char *argv0); /** Set @log_title to the program name extracted from @argv[0]. **/ void log_fork(void); /** Call after fork() to update @log_pid. **/ diff --git a/ucw/string.h b/ucw/string.h index 8122b1cf..0c64ace5 100644 --- a/ucw/string.h +++ b/ucw/string.h @@ -30,7 +30,7 @@ /* string.c */ #ifdef CONFIG_DARWIN -uns strnlen(const char *str, uns n); +uns strnlen(const char *str, uns n); // NOAPI #endif /**