Permalink
Browse files

Strip out some more inline functions in test_include.sh

  • Loading branch information...
1 parent 8be322f commit f0d734de937c26cfaad61f10e03c8c282d3900e7 @jmckaskill jmckaskill committed May 9, 2012
Showing with 19 additions and 11 deletions.
  1. +19 −11 test_includes.sh
View
30 test_includes.sh
@@ -1,17 +1,25 @@
#!/bin/sh
make test || exit
+rm -rf test_includes
mkdir -p test_includes
for f in /usr/include/*.h
do
- echo "${f}";
- (cc -E -c "${f}" || continue) | lua -e '
- local str = io.read("*a")
- -- remove preprocessor commands eg line directives
- str = str:gsub("#[^\n]*", "")
- -- remove inline function definitions and declarations
- str = str:gsub("static [^;(]* __attribute__%b()", "static ")
- str = str:gsub("static [^;(]*%b()%s*%b{}", "")
- str = str:gsub("static [^;(]*%b()%s*;", "")
- io.write(str)' > "test_includes/`basename $f`"
- lua -e 'ffi = require("ffi"); ffi.cdef(io.read("*a"))' < "test_includes/`basename $f`"
+ gcc -E -c "${f}" > tmp 2>/dev/null
+ if [ $? == 0 ]
+ then
+ echo "${f}";
+ lua -e '
+ local str = io.read("*a")
+ -- remove preprocessor commands eg line directives
+ str = str:gsub("#[^\n]*", "")
+ -- remove inline function definitions and declarations
+ str = str:gsub("extern%s+__inline__", "static")
+ str = str:gsub("extern%s+__inline", "static")
+ str = str:gsub("static[^;(]+__attribute__%s*%b()", "static ")
+ str = str:gsub("static[^;(]+__attribute__%s*%b()", "static ")
+ str = str:gsub("static[^;(]+%b()%s*%b{}", "")
+ str = str:gsub("static[^;(]+%b()%s*;", "")
+ io.write(str)' > "test_includes/`basename $f`" < tmp
+ lua -e 'ffi = require("ffi"); ffi.cdef(io.read("*a"))' < "test_includes/`basename $f`"
+ fi
done

0 comments on commit f0d734d

Please sign in to comment.