| 1 | #!/bin/bash |
| 2 | |
| 3 | # check_syntax.sh - a small script to search for interface headers with |
| 4 | # missing semicolons (they give troubles to Doxygen). |
| 5 | # RCS-ID: $Id$ |
| 6 | # Author: Francesco Montorsi |
| 7 | |
| 8 | |
| 9 | rm -f missing_semicolons |
| 10 | |
| 11 | # the preprocessor will remove comments and all #preprocessor #stuff; |
| 12 | # we then remove the empty lines |
| 13 | for iface in wx/*h; do |
| 14 | |
| 15 | echo "--- $iface ---" >>missing_semicolons |
| 16 | |
| 17 | gcc -E $iface | grep -v '#' | grep -v '^[[:space:]]*$' >temp |
| 18 | |
| 19 | # now remove the lines which ends with a comma or a semicolon; they're ok |
| 20 | cat temp | grep -v '.*;$' | grep -v '.*,$' >temp2 |
| 21 | |
| 22 | # now search for methods; we know they should always contain at least two () brackets! |
| 23 | cat temp2 | grep '(' >>missing_semicolons |
| 24 | |
| 25 | # now remove the lines which shouldn't have final comma or semicolon: |
| 26 | # cat temp2 | grep -v '^[[:space:]]*wx[A-Z]*[[:space:]]*$' >temp |
| 27 | # cat temp | grep -v 'class' | grep -v 'enum' | grep -v 'template' | \ |
| 28 | # grep -v 'struct' | grep -v 'typedef' | \ |
| 29 | # grep -v 'public:' | grep -v 'protected:' | grep -v 'private:' | \ |
| 30 | # grep -v '{' | grep -v '}' >>missing_semicolons |
| 31 | |
| 32 | done |
| 33 | |
| 34 | rm temp temp2 |