From 121e5e7264cef604e570b84ad16d5d16833b3460 Mon Sep 17 00:00:00 2001 From: nsz Date: Wed, 14 Sep 2011 14:47:47 +0200 Subject: [PATCH] fix findproblems --- data/musl.problems | 29 +++++++++++++++++++++++++++++ findproblems.sh | 31 ++++++++++++++++++++++++++----- makeproto.sh | 2 +- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/data/musl.problems b/data/musl.problems index b537c57..89fd900 100644 --- a/data/musl.problems +++ b/data/musl.problems @@ -19,20 +19,49 @@ nodecl fread_unlocked W nodecl fwrite_unlocked W nodecl getdents W nodecl getdomainname T +header getopt getopt.h unistd.h nodecl getw T nodecl getwc_unlocked W nodecl getwchar_unlocked W header htonl netinet/in.h arpa/inet.h header htons netinet/in.h arpa/inet.h +header iswalnum wchar.h wctype.h +header iswalpha wchar.h wctype.h +header iswblank wchar.h wctype.h +header iswcntrl wchar.h wctype.h +header iswctype wchar.h wctype.h +header iswdigit wchar.h wctype.h +header iswdigit wchar.h wctype.h +header iswgraph wchar.h wctype.h +header iswlower wchar.h wctype.h +header iswprint wchar.h wctype.h +header iswpunct wchar.h wctype.h +header iswspace wchar.h wctype.h +header iswupper wchar.h wctype.h +header iswxdigit wchar.h wctype.h header ntohl netinet/in.h arpa/inet.h header ntohs netinet/in.h arpa/inet.h +header optarg getopt.h unistd.h +header opterr getopt.h unistd.h +header optind getopt.h unistd.h +header optopt getopt.h unistd.h nodecl pivot_root T proto poll poll.h int(struct pollfd*,nfds_t,int) int(struct pollfd[],nfds_t,int) int poll (struct pollfd *, nfds_t, int); int poll(struct pollfd fds[], nfds_t nfds, int timeout); nodecl putw T nodecl putwc_unlocked W nodecl putwchar_unlocked W nodecl scalbf T +proto setgroups unistd.h grp.h int setgroups(size_t, const gid_t []); int setgroups(size_t, const gid_t *); nodecl sincos T nodecl start T nodecl stime T +header strcasecmp string.h strings.h +header strncasecmp string.h strings.h +header towlower wchar.h wctype.h +header towupper wchar.h wctype.h +header va_arg bits/stdarg.h stdarg.h +header va_copy bits/stdarg.h stdarg.h +header va_end bits/stdarg.h stdarg.h +header va_start bits/stdarg.h stdarg.h header wcrtomb wchar.h stdio.h +header wctype wchar.h wctype.h diff --git a/findproblems.sh b/findproblems.sh index e5f73a5..18d0a93 100755 --- a/findproblems.sh +++ b/findproblems.sh @@ -8,16 +8,22 @@ export LC_ALL=C awk -F'\t' '{print $2}' data/musl.syms } |sort |uniq |awk -F'\t' ' BEGIN { - posix = "data/posix2008.ok.proto" syms = "data/musl.syms" tags = "data/musl.tags.proto" + posix = "data/posix2008.ok.proto" while (getline < syms == 1) sym[$2] = $1 # todo: same tag may be defined in several headers - while (getline < tags == 1) - tag[$1] = $2 "\t" $3 "\t" $5 "\t" $6 + while (getline < tags == 1) { + if ($5 ~ /^#undef/) + continue + if ($1 in tag) + tag[$1] = tag[$1] "@" $2 "\t" $3 "\t" $5 "\t" $6 + else + tag[$1] = $2 "\t" $3 "\t" $5 "\t" $6 + } while (getline < posix == 1) pos[$1] = $2 "\t" $5 "\t" $6 @@ -31,7 +37,13 @@ BEGIN { if (pos[$1]) s = s " posix" - print $1 "\t" substr(s,2) "\t" sym[$1] "\t" tag[$1] "\t" pos[$1] + n = split(tag[$1],a,"@") + if (n==0) { + n=1 + a[1]="" + } + for (i = 1; i <= n; i++) + print $1 "\t" substr(s,2) "\t" sym[$1] "\t" a[i] "\t" pos[$1] }' >data/musl.all awk -F'\t' ' @@ -40,9 +52,18 @@ $2 == "obj" || $2 == "obj posix" { if ($1 !~ /^_/) print "nodecl\t" $1 "\t" $3 } +$2 ~ /inc/ && $5 == "p" { + # check for different declarations of the same symbol + if ($1 in proto) { + if (proto[$1] != $6) + print "proto\t" $1 "\t" $4 "\t" head[$1] "\t" $6 "\t" proto[$1] + } else { + proto[$1] = $6 + head[$1] = $4 + } +} $2 ~ /inc posix/ && $4 != $8 { # different header - n = split($8, a, " ") for (i = 1; i <= n; i++) if ($4 == a[i]) diff --git a/makeproto.sh b/makeproto.sh index 41aadc5..be4c42f 100755 --- a/makeproto.sh +++ b/makeproto.sh @@ -3,7 +3,7 @@ export LC_ALL=C MUSL=${MUSL:-../musl} -awk -F'\t' '{print $5}' data/musl.tags |./type.sh >/tmp/tags.type +awk -F'\t' '{if($3=="p")print $5; else print ""}' data/musl.tags |./type.sh >/tmp/tags.type awk -F'\t' '{print $5}' data/posix2008.ok |./type.sh >/tmp/posix2008.type join() { -- 2.20.1