Skip to content
Permalink
Browse files
Preprocess header file in sipdiff to reduce noise
and common sources of trouble.
  • Loading branch information
m-kuhn committed Dec 5, 2016
1 parent b7daf9b commit abbe281bc792e26a364b75b7e1d9309d08f4e5fb
Showing with 24 additions and 5 deletions.
  1. +24 −5 scripts/sipdiff
@@ -1,10 +1,29 @@
#!/bin/bash

for file in $*; do
d=${file#*/}
d=${d%/*}
f=${file##*/}
f=${f%.*}
d=${file#*/}
d=${d%/*}
f=${file##*/}
f=${f%.*}

vimdiff src/$d/$f.h python/$d/$f.sip
tempfile=$(mktemp ${f}XXXX --suffix=.h)

# Remove comments
sed 's/a/aA/g;s/__/aB/g;s/#/aC/g' "src/$d/$f.h" | gcc -P -E $arg - | sed 's/aC/#/g;s/aB/__/g;s/aA/a/g' > $tempfile

# Remove override keyword
sed -i 's/ override;/;/g' $tempfile

# Remove preprocessor directives
sed -i '/^#/d' $tempfile

# Remove CORE_EXPORT etc
sed -i 's/ [A-Z]*_EXPORT//g' $tempfile

# Remove public keyword from inherited classes
sed -i 's/\(class.*:\) public\(.*\)/\1\2/g' $tempfile

vimdiff $tempfile python/$d/$f.sip

rm $tempfile
done

0 comments on commit abbe281

Please sign in to comment.