[glibmm] tools: Add the testmmh.sh script.



commit e998d27cae0725c9dab4b163c6638348dea5e7bd
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Sat May 18 11:57:13 2013 +0200

    tools: Add the testmmh.sh script.
    
    * tools/test_scripts/testmmh.sh: New file. Checks if all header files are
    included in a <name>mm.h file. Bug #699993.

 ChangeLog                     |    7 +++++++
 tools/test_scripts/testmmh.sh |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 508ec67..52c4dc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-18  Kjell Ahlstedt  <kjell ahlstedt bredband net>
+
+       tools: Add the testmmh.sh script.
+
+       * tools/test_scripts/testmmh.sh: New file. Checks if all header files are
+       included in a <name>mm.h file. Bug #699993.
+
 2013-05-14  José Alburquerque  <jaalburquerque gmail com>
 
        Custom Interface Properties: Use base finalize function to free data.
diff --git a/tools/test_scripts/testmmh.sh b/tools/test_scripts/testmmh.sh
new file mode 100755
index 0000000..2cadfc1
--- /dev/null
+++ b/tools/test_scripts/testmmh.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Check if all header files are included in file <dir>/<dir>mm.h.
+
+# Example: In glibmm, go to directory glibmm, and run
+#   tools/test_scripts/testmmh.sh gio   # check glibmm/gio/giomm.h
+#   tools/test_scripts/testmmh.sh glib  # check glibmm/glib/glibmm.h
+
+# For each file $1/$1mm/<name>.h, check if $1mm/<name>.h is included in $1/$1mm.h.
+# If the file is not included in $1/$1mm.h, search for inclusion in any of the
+# files $1/$1mm/<name>.h. Thus you can see if it's included indirectly via
+# another header file.
+
+# Some manual checking of $1/$1mm.h is usually necessary.
+# Perhaps some header files (like wrap_init.h and <name>_private.h) shall not be included.
+# Other header files shall perhaps be surrounded by #ifdef/#ifndef/#endif directives.
+
+if [ $# -ne 1 ]
+then
+  echo "Usage $0 <directory>"
+  exit 1
+fi
+
+for headerfile in $1/$1mm/*.h
+do
+  h1="${headerfile#$1/}" # Delete the "$1/" prefix
+  h2="${h1//./\.}" # Replace each "." by "\."
+  echo "=== $h1"
+  grep -q  "^ *# *include  *<$h2>" $1/$1mm.h
+  if [ $? -ne 0 ]
+  then
+    echo "  Missing"
+    grep "<$h2>" $1/$1mm/*.h
+  fi
+done
+
+exit 0
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]