X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=makedecls.sh;h=ca99085dd3c8ad6d649cadf540230af98cdc0857;hb=7317cc3345e033d52594fb934d922514a49e8ff6;hp=ff8c6acd5b2c955793f42cc773f271264ec09ae6;hpb=b6bf10a24409113ea5d4d042efb2c7421696f04b;p=musl-tables diff --git a/makedecls.sh b/makedecls.sh index ff8c6ac..ca99085 100755 --- a/makedecls.sh +++ b/makedecls.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -xeu +set -eu export LC_ALL=C @@ -11,9 +11,11 @@ ALL=' aarch64 arm i386 +m68k microblaze mips mips64 +mipsn32 or1k powerpc powerpc64 @@ -24,11 +26,11 @@ x86_64 ARCH="${ARCH:-$ALL}" -# install headers to T.$arch +# install headers to /tmp/T.$arch for arch in $ARCH do [ -e T.$arch ] && continue -make -f "$MUSL"/Makefile install-headers srcdir="$MUSL" prefix=T.$arch ARCH=$arch +make -f "$MUSL"/Makefile install-headers srcdir="$MUSL" prefix=/tmp/T.$arch ARCH=$arch rm -rf obj/include/bits done rm -rf obj lib @@ -36,19 +38,21 @@ rm -rf obj lib # run ctags on headers for arch in $ARCH do -[ -e T.$arch/musl.tags ] && continue -cd T.$arch/include +[ -e /tmp/T.$arch/musl.tags ] && continue +( +cd /tmp/T.$arch/include ctags -f ../musl.tags -R -n -u --language-force=c --c-kinds=pxdstuve --fields=k . # fix wchar_t bug of ctags (not ok for c++) awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>../musl.tags -cd ../.. +) done # add declarations (slow) for arch in $ARCH do -[ -e T.$arch/musl.decls ] && continue -cd T.$arch/include +[ -e /tmp/T.$arch/musl.decls ] && continue +( +cd /tmp/T.$arch/include awk ' BEGIN { FS="\t" } @@ -75,34 +79,36 @@ function decl(t,h,n) { $1 = "struct " $1 if ($4 == "u") $1 = "union " $1 - print $1 "\t" $2 "\t" $4 "\t" $3 "\t" decl($4,$2,$3) +# print $1 "\t" $2 "\t" $4 "\t" $3 "\t" decl($4,$2,$3) + # without line number + print $1 "\t" $2 "\t" $4 "\t" decl($4,$2,$3) }' ../musl.tags >../musl.decls.raw # fix ups awk ' BEGIN { FS="\t" } -$3=="d" && $5 ~ /^#undef/ {next} -$3=="x" && $5 ~ /^(struct|union) [_0-9a-zA-Z]*;$/ { - a = ($5 ~ /^struct/) ? "struct " : "union " - b = ($5 ~ /^struct/) ? "S" : "U" - print a $1 "\t" $2 "\t" b "\t" $4 "\t" $5 +$3=="d" && $4 ~ /^#undef/ {next} +$3=="x" && $4 ~ /^(struct|union) [_0-9a-zA-Z]*;$/ { + a = ($4 ~ /^struct/) ? "struct " : "union " + b = ($4 ~ /^struct/) ? "S" : "U" + print a $1 "\t" $2 "\t" b "\t" $4 next } $1~/^(FILE|DIR)$/ { - print $1 "\t" $2 "\tT\t" $4 "\t" $5 + print $1 "\t" $2 "\tT\t" $4 next } { print $0 }' ../musl.decls.raw | sort >../musl.decls -cd ../.. +) done # add decls to data/ for arch in $ARCH do -grep ' bits/' T.$arch/musl.decls >data/musl.$arch.decls +grep ' bits/' /tmp/T.$arch/musl.decls >data/musl.$arch.decls done for arch in $ARCH do -grep -v ' bits/' T.$arch/musl.decls >data/musl.generic.decls +grep -v ' bits/' /tmp/T.$arch/musl.decls >data/musl.generic.decls break done