check prototypes in src/ as well
authornsz <nsz@port70.net>
Sun, 18 Sep 2011 14:54:47 +0000 (16:54 +0200)
committernsz <nsz@port70.net>
Sun, 18 Sep 2011 14:54:47 +0000 (16:54 +0200)
data/musl.problems
findproblems.sh
makeproto.sh
maketagssrc.sh [new file with mode: 0755]
tab_c99.html
tab_posix.html
update.sh [new file with mode: 0755]

index 107d406..0ca4b50 100644 (file)
@@ -1,9 +1,9 @@
+proto  __syscall_ret   internal/syscall_ret.c  sys/syscall.h   long(unsigned long)     long(long)
 nodecl cfmakeraw       T
 nodecl cfsetspeed      W
 nodecl clearerr_unlocked       W
 nodecl crypt_r W
 nodecl daemon  T
-nodecl dst_offset      V
 proto  encrypt unistd.h        void(char*,int) void(char[],int)        void encrypt(char *, int);      void encrypt(char block[64], int edflag);
 nodecl environ V
 nodecl feof_unlocked   W
@@ -18,16 +18,23 @@ nodecl      fread_unlocked  W
 nodecl fwrite_unlocked W
 nodecl getdents        W
 nodecl getdomainname   T
+proto  gethostent      network/ent.c   netdb.h void*() struct hostent*(void)
 nodecl getw    T
 nodecl getwc_unlocked  W
 nodecl getwchar_unlocked       W
 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);
+proto  pthread_equal   thread/pthread_equal.c  pthread.h       int()(pthread_t,pthread_t)      int(pthread_t,pthread_t)
 nodecl putw    T
 nodecl putwc_unlocked  W
 nodecl putwchar_unlocked       W
+proto  qsort   stdlib/qsort.c  stdlib.h        void(void*,size_t,size_t,)      void(void*,size_t,size_t,int(*)(const void*,const void*))
+proto  sbrk    linux/sbrk.c    unistd.h        void*(ptrdiff_t)        void*(intptr_t)
 nodecl scalbf  T
+proto  seed48  prng/seed48.c   stdlib.h        unsigned short*(unsigned short*)        unsigned short*(unsigned short[])
 proto  setgroups       unistd.h        grp.h   int setgroups(size_t, const gid_t []);  int setgroups(size_t, const gid_t *);
+proto  setgroups       linux/setgroups.c       grp.h   int(size_t,const gid_t[])       int(size_t,const gid_t*)
+proto  setpgid unistd/setpgid.c        unistd.h        pid_t(pid_t,pid_t)      int(pid_t,pid_t)
 nodecl sincos  T
 nodecl start   T
 nodecl stime   T
index 233079a..3bea684 100755 (executable)
@@ -10,6 +10,7 @@ export LC_ALL=C
 BEGIN {
        syms = "data/musl.syms"
        tags = "data/musl.tags.proto"
+       srctags = "data/musl.src.tags.proto"
        posix = "data/posix2008.ok.proto"
 
        while (getline < syms == 1)
@@ -24,6 +25,15 @@ BEGIN {
                        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
 }
@@ -33,19 +43,25 @@ 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"
 
        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]
+       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 = ""
@@ -55,21 +71,32 @@ $2 == "obj" || $2 == "obj posix" {
        if ($1 !~ /^_/)
                print "nodecl\t" $1 "\t" $3
 }
-$2 ~ /inc/ && $5 == "p" {
+$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\// {
+$2 ~ /inc posix/ && head[$1] != $8 && $4 !~ /^bits\// && $5 != "f" {
        # different header
        n = split($8, a, " ")
        for (i = 1; i <= n; i++)
@@ -90,5 +117,5 @@ END{
        if(herr)
                print herr
 }
-' data/musl.all >data/musl.problems
+' data/musl.all |uniq >data/musl.problems
 
index be4c42f..4eae1f2 100755 (executable)
@@ -4,6 +4,7 @@ export LC_ALL=C
 MUSL=${MUSL:-../musl}
 
 awk -F'\t' '{if($3=="p")print $5; else print ""}' data/musl.tags |./type.sh >/tmp/tags.type
+awk -F'\t' '{if($3=="f")print $5; else print ""}' data/musl.src.tags |./type.sh >/tmp/src.tags.type
 awk -F'\t' '{print $5}' data/posix2008.ok |./type.sh >/tmp/posix2008.type
 
 join() {
@@ -11,6 +12,7 @@ join() {
 }
 
 join data/musl.tags /tmp/tags.type >data/musl.tags.proto
+join data/musl.src.tags /tmp/src.tags.type >data/musl.src.tags.proto
 join data/posix2008.ok /tmp/posix2008.type >data/posix2008.ok.proto
 
-rm -f /tmp/tags.type /tmp/posix2008.type
+rm -f /tmp/*.type
diff --git a/maketagssrc.sh b/maketagssrc.sh
new file mode 100755 (executable)
index 0000000..f316785
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+export LC_ALL=C
+MUSL=${MUSL:-../musl}
+
+(
+       cd $MUSL/src
+#      ctags -f /tmp/musl.tags -R -n -u --language-force=c --c-kinds=pxdstuf --fields=k --exclude='*.sh' --exclude='*o' --exclude='*.s' .
+       ctags -f /tmp/musl.tags -R -n -u --language-force=c --c-kinds=xtf --fields=k --exclude='*.sh' --exclude='*o' --exclude='*.s' .
+)
+
+awk -v src=$MUSL/src/ '
+BEGIN {
+       FS="\t"
+}
+function proto(t,f,n) {
+       if (t == "f" && n > 1)
+               n--
+       cmd = "awk '\''NR==" n
+       if (t == "p")
+               cmd = cmd "{s=$0; if(s!~/;/){getline; s=s \" \" $0} print s; exit}"
+       else if (t == "f") {
+               cmd = cmd "{s=$0; sub(/^#.*/,\"\",s); gsub(/\\/\\/.*/,\"\",s); gsub(/.*\\*\\//,\"\",s);"
+               cmd = cmd "while(s!~/{/){getline; s=s \" \" $0} sub(/ *{.*$/,\"\",s); print s; exit}"
+       } else if (t == "d")
+               cmd = cmd "{s=$0; while(gsub(/\\\\$/,\"\",s)){getline; s=s $0} print s; exit}"
+       else
+               return ""
+       cmd = cmd "'\'' " src f
+       cmd | getline s
+       close(cmd)
+       gsub(/\t/, " ", s)
+       gsub(/ +/, " ", s)
+       sub(/^ /,"",s)
+       return s
+}
+/^[^!]/ {
+       gsub(/[^0-9]*/,"",$3)
+       if ($4 == "s")
+               $1 = "struct " $1
+       if ($4 == "u")
+               $1 = "union " $1
+       p = proto($4,$2,$3)
+       if ($4 != "f" || p !~ /static/)
+               print $1 "\t" $2 "\t" $4 "\t" $3 "\t" p
+}' /tmp/musl.tags |sort >data/musl.src.tags
+rm -f /tmp/musl.tags
index 0644b15..01b5d5c 100644 (file)
@@ -1,5 +1,5 @@
 <h3>musl vs c99 api</h3>
-<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=4da289e1b3a0d09048d9be1dfc3a7280531a1e48">4da289e1b3a0d09048d9be1dfc3a7280531a1e48</a><br>Date:   Tue Sep 13 21:21:53 2011 -0400<br><br>    fix return types for aio_read and aio_write again<br>    <br>    previous fix was backwards and propagated the wrong type rather than<br>    the right one...
+<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=3f72cdac73030761120cf32aeef44e7d03e2f1fa">3f72cdac73030761120cf32aeef44e7d03e2f1fa</a><br>Date:   Sun Sep 18 10:14:37 2011 -0400<br><br>    overhaul clone syscall wrapping<br>    <br>    several things are changed. first, i have removed the old __uniclone<br>    function signature and replaced it with the "standard" linux<br>    __clone/clone signature. this was necessary to expose clone to<br>    applications anyway, and it makes it easier to port __clone to new<br>    archs, since it's now testable independently of pthread_create.<br>    <br>    secondly, i have removed all references to the ugly ldt descriptor<br>    structure (i386 only) from the c code and pthread structure. in places<br>    where it is needed, it is now created on the stack just when it's<br>    needed, in assembly code. thus, the i386 __clone function takes the<br>    desired thread pointer as its argument, rather than an ldt descriptor<br>    pointer, just like on all other sane archs. this should not affect<br>    applications since there is really no way an application can use clone<br>    with threads/tls in a way that doesn't horribly conflict with and<br>    clobber the underlying implementation's use. applications are expected<br>    to use clone only for creating actual processes, possibly with new<br>    namespace features and whatnot.
 <h4>legend</h4><ul><li>status: musl implementation status summary<ul><li>(empty) - implemented<li>nosym - prototype found in include files (see decl) but not in libc.a (see sym)<li>nodecl - symbol is in libc.a but not declared in a public header<li>missing - neither in include files (see decl) nor in libc.a (see sym)</ul><li>sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)<ul><li>C - symbol is common (uninitialized data)<li>D - symbol is in the initialized data section<li>R - symbol is in the read only data section<li>T - symbol is in the text section<li>V - weak object<li>W - weak symbol</ul><li>decl: kind of declaration as found by `ctags -R include` (every occurance is reported, arch specific definitions are not linked)<ul><li>d - macro definition<li>t - typedef<li>s - struct declaration<li>u - union declaration<li>p - function prototype<li>x - external and forward variable declaration</ul></ul>
 <h4>table</h4><table border=1><tr><th colspan=3>musl<th colspan=4>c99<tr><th>status<th>sym<th>decl<th>name<th>header<th>proto<th>section
 <tr><td>missing<td>&#160;<td>&#160;<td>NDEBUG<td>assert.h<td>&#160;<td>B.1 Diagnostics
index 3b37e97..e7a0280 100644 (file)
@@ -1,5 +1,5 @@
 <h3>musl vs posix api</h3>
-<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=4da289e1b3a0d09048d9be1dfc3a7280531a1e48">4da289e1b3a0d09048d9be1dfc3a7280531a1e48</a><br>Date:   Tue Sep 13 21:21:53 2011 -0400<br><br>    fix return types for aio_read and aio_write again<br>    <br>    previous fix was backwards and propagated the wrong type rather than<br>    the right one...
+<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=3f72cdac73030761120cf32aeef44e7d03e2f1fa">3f72cdac73030761120cf32aeef44e7d03e2f1fa</a><br>Date:   Sun Sep 18 10:14:37 2011 -0400<br><br>    overhaul clone syscall wrapping<br>    <br>    several things are changed. first, i have removed the old __uniclone<br>    function signature and replaced it with the "standard" linux<br>    __clone/clone signature. this was necessary to expose clone to<br>    applications anyway, and it makes it easier to port __clone to new<br>    archs, since it's now testable independently of pthread_create.<br>    <br>    secondly, i have removed all references to the ugly ldt descriptor<br>    structure (i386 only) from the c code and pthread structure. in places<br>    where it is needed, it is now created on the stack just when it's<br>    needed, in assembly code. thus, the i386 __clone function takes the<br>    desired thread pointer as its argument, rather than an ldt descriptor<br>    pointer, just like on all other sane archs. this should not affect<br>    applications since there is really no way an application can use clone<br>    with threads/tls in a way that doesn't horribly conflict with and<br>    clobber the underlying implementation's use. applications are expected<br>    to use clone only for creating actual processes, possibly with new<br>    namespace features and whatnot.
 <h4>legend</h4><ul><li>status: musl implementation status summary<ul><li>(empty) - implemented<li>nosym - prototype found in include files (see decl) but not in libc.a (see sym)<li>nodecl - symbol is in libc.a but not declared in a public header<li>missing - neither in include files (see decl) nor in libc.a (see sym)</ul><li>sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)<ul><li>C - symbol is common (uninitialized data)<li>D - symbol is in the initialized data section<li>R - symbol is in the read only data section<li>T - symbol is in the text section<li>V - weak object<li>W - weak symbol</ul><li>decl: kind of declaration as found by `ctags -R include` (every occurance is reported)<ul><li>d - macro definition<li>p - function prototype<li>x - external and forward variable declaration</ul></ul><p>(STREAMS and posix_trace* apis are excluded)
 <h4>table</h4><table border=1><tr><th colspan=3>musl<th colspan=4>posix<tr><th>status<th>sym<th>decl<th>name<th>header<th>option<th>desc
 <tr><td>&#160;<td>&#160;<td><a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=blob;f=include/sys/select.h#l27">d</a> <td><a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/FD_CLR.html">FD_CLR</a><td> <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html">sys/select.h</a><td>&#160;<td>pselect, select - synchronous I/O multiplexing
diff --git a/update.sh b/update.sh
new file mode 100755 (executable)
index 0000000..84f3395
--- /dev/null
+++ b/update.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+export LC_ALL=C
+
+. ./makesyms.sh
+. ./maketags.sh
+. ./maketagssrc.sh
+. ./tab_c99.sh
+. ./tab_posix.sh
+. ./findproblems.sh