projects
/
musl-tables
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor fix to the type table
[musl-tables]
/
type.sh
diff --git
a/type.sh
b/type.sh
index
3aa5a9c
..
d6f522b
100755
(executable)
--- a/
type.sh
+++ b/
type.sh
@@
-5,25
+5,20
@@
export LC_ALL=C
# drop names from a declaration (hack to make prototypes comparable)
awk '
BEGIN {
# drop names from a declaration (hack to make prototypes comparable)
awk '
BEGIN {
- # type is not typedefed so next unknown id is probably a variable name
- split("void char short int long float double signed unsigned _Bool _Complex", a)
+ # builtin type specifiers/qualifiers..
+ s = "void char short int long float double signed unsigned _Bool _Complex bool complex"
+ s = s " static extern auto register inline const volatile restrict __restrict"
+ # typedef names in posix without _t
+ s = s " FILE DIR VISIT ENTRY ACTION DBM datum fd_set jmp_buf sigjmp_buf va_list nl_item nl_catd"
+ s = s " scalar real-floating" # used in macros
+ split(s, a)
for (i in a)
for (i in a)
- tok[a[i]] = "
type
"
+ tok[a[i]] = "
builtin
"
- # next token is an id
, type is not typedefed
+ # next token is an id
split("struct union enum", a)
for (i in a)
tok[a[i]] = "struct"
split("struct union enum", a)
for (i in a)
tok[a[i]] = "struct"
-
- # decoratoin that can be skipped
- split("static extern auto register inline const volatile restrict", a)
- for (i in a)
- tok[a[i]] = "decor"
-
- # punctuators
- split("( ) [ ] , ... *", a)
- for (i in a)
- tok[a[i]] = "punct"
}
function put(tok) {
}
function put(tok) {
@@
-41,40
+36,29
@@
function put(tok) {
gsub(/\/\*[^/]*\*\//, "")
gsub(/\/\/.*/, "")
gsub(/\/\*[^/]*\*\//, "")
gsub(/\/\/.*/, "")
- gsub(/[^a-zA-Z0-9_.]/," & ")
+ gsub(/[^a-zA-Z0-9_.
-
]/," & ")
gsub(/\.\.\./, " & ")
gsub(/\.\.\./, " & ")
- state = "type"
sep = ""
s = ""
for (i = 1; i <= NF; i++) {
if ($i == ";")
break
sep = ""
s = ""
for (i = 1; i <= NF; i++) {
if ($i == ";")
break
- if (state == "type") {
+ if ($i ~ /[a-zA-Z_][a-zA-Z0-9_]*/ && !tok[$i] && $i !~ /_t$/)
+ continue
+ put($i)
+ if (tok[$i] == "struct") {
+ i++
put($i)
put($i)
- if (!tok[$i] || tok[$i] == "type")
- state = "id"
- if (tok[$i] == "struct") {
- i++
- put($i)
- state = "id"
- }
- } else if (state == "id") {
- if (!tok[$i]) {
- state = "idfound"
- continue
- }
- put($i)
- if ($i == ")")
- state = "idfound"
- if ($i == ",")
- state = "type"
- } else if (state == "idfound") {
- put($i)
- if ($i == "(" || $i == ",")
- state = "type"
}
}
}
}
+
+ # fixes
+ gsub(/\[[0-9]+\]/, "[]", s)
+ gsub(/unsigned int/, "unsigned", s)
+ gsub(/long int/, "long", s)
+ gsub(/__restrict/, "restrict", s)
+
print s
}
'
print s
}
'