On Mon, Feb 13, 2012 at 8:33 PM, Ted Kremenek <[email protected]> wrote:
> Looks great.  It looks like your script assumes that none of the header files 
> in include have methods that issue diagnostics.  Is this true?

Right.  That is true today, but it might change in future.  Attached
patch adds `include' to the search path.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
Index: utils/find-unused-diagnostics.sh
===================================================================
--- utils/find-unused-diagnostics.sh	(revision 0)
+++ utils/find-unused-diagnostics.sh	(revision 0)
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# This script produces a list of all diagnostics that are defined
+# in Diagnostic*.td files but not used in sources.
+#
+
+ALL_DIAGS=$(mktemp)
+ALL_SOURCES=$(mktemp)
+
+grep -E --only-matching --no-filename '(err_|warn_|ext_|note_)[a-z_]+ ' ./include/clang/Basic/Diagnostic*.td > $ALL_DIAGS
+find lib include tools -name \*.cpp -or -name \*.h > $ALL_SOURCES
+for DIAG in $(cat $ALL_DIAGS); do
+  if ! grep -r $DIAG $(cat $ALL_SOURCES) > /dev/null; then
+    echo $DIAG
+  fi;
+done
+
+rm $ALL_DIAGS $ALL_SOURCES
+

Property changes on: utils/find-unused-diagnostics.sh
___________________________________________________________________
Added: svn:executable
   + *

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to