X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=findproblems.sh;h=3bea684ccc21f2048d46d68fabc5fc38734ea6ae;hb=945eb4635a659bbbac691c9d474459d3d2954db6;hp=e5f73a5e1cf4f150a3b7998409646b6b36fbe37a;hpb=77fc72c061a0bf88335052377ee89df45dfd846b;p=musl-tables diff --git a/findproblems.sh b/findproblems.sh index e5f73a5..3bea684 100755 --- a/findproblems.sh +++ b/findproblems.sh @@ -8,16 +8,31 @@ 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" + srctags = "data/musl.src.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 < srctags == 1) { + if ($3 != "f") + continue + if ($1 in stag) + stag[$1] = stag[$1] "@" $2 "\t" $3 "\t" $5 "\t" $6 + else + stag[$1] = $2 "\t" $3 "\t" $5 "\t" $6 + } while (getline < posix == 1) pos[$1] = $2 "\t" $5 "\t" $6 @@ -28,31 +43,79 @@ BEGIN { s = s " obj" if (tag[$1]) s = s " inc" + else + tag[$1] = "\t\t\t" if (pos[$1]) s = s " posix" + else + pos[$1] = "\t\t" - print $1 "\t" substr(s,2) "\t" sym[$1] "\t" tag[$1] "\t" pos[$1] + n = split(tag[$1],a,"@") + for (i = 1; i <= n; i++) + print $1 "\t" substr(s,2) "\t" sym[$1] "\t" a[i] "\t" pos[$1] + n = split(stag[$1],a,"@") + 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' ' +BEGIN { +} + +herr && lastid != $1 { + print herr + herr = "" +} $2 == "obj" || $2 == "obj posix" { # not declared if ($1 !~ /^_/) print "nodecl\t" $1 "\t" $3 } -$2 ~ /inc posix/ && $4 != $8 { +$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 + protoshort[$1] = $7 + head[$1] = $4 + } +} +$5 == "f" && $1 in protoshort { + # func definition with different proto + dec = protoshort[$1] + def = $7 + gsub(/extern */, "", dec) + gsub(/void/, "", dec) + gsub(/void/, "", def) + if (protoshort[$1] != $7 && dec != def) + print "proto\t" $1 "\t" $4 "\t" head[$1] "\t" $7 "\t" protoshort[$1] +} +$2 ~ /inc posix/ && $4 == $8 { + head[$1] = $4 + herr = "" +} +$2 ~ /inc posix/ && head[$1] != $8 && $4 !~ /^bits\// && $5 != "f" { # different header - n = split($8, a, " ") for (i = 1; i <= n; i++) if ($4 == a[i]) break if (i > n) - print "header\t" $1 "\t" $4 "\t" $8 + # delay error msg + herr = "header\t" $1 "\t" $4 "\t" $8 } $2 ~ /inc posix/ && $7 != $10 && $5 == "p" { # different prototype print "proto\t" $1 "\t" $4 "\t" $7 "\t" $10 "\t" $6 "\t" $9 } -' data/musl.all >data/musl.problems +{ + lastid = $1 +} +END{ + if(herr) + print herr +} +' data/musl.all |uniq >data/musl.problems