check_syntax.sh 1.1 KB

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