Revision: 56957
http://sourceforge.net/p/brlcad/code/56957
Author: brlcad
Date: 2013-08-19 17:02:15 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
previous common.h check only tested to make sure common.h came first in the
file if it's included at all. new check also makes sure that common.h is
included if there are any system headers included first since common.h should
come first. currently disabled since there are several files that need to be
fixed.
Modified Paths:
--------------
brlcad/trunk/regress/repository.sh
Modified: brlcad/trunk/regress/repository.sh
===================================================================
--- brlcad/trunk/regress/repository.sh 2013-08-19 15:19:53 UTC (rev 56956)
+++ brlcad/trunk/regress/repository.sh 2013-08-19 17:02:15 UTC (rev 56957)
@@ -60,7 +60,8 @@
###
-# TEST: make sure nobody includes private headers like bio.h in a public header
+# TEST: make sure nobody includes private headers like bio.h in a
+# public header
echo "running public header private header checks..."
for i in bio.h bin.h bselect.h ; do
@@ -80,26 +81,38 @@
###
-# TEST: make sure common.h is always included first
+# TEST: make sure common.h is always included first when included
echo "running common.h inclusion order check..."
-COMMONSRCS="`grep -n -I -e '#[[:space:]]*include' $SRCFILES /dev/null | grep
'\"common.h\"' | sed 's/:.*//g'`"
-COMMONINCS="`grep -n -I -e '#[[:space:]]*include' $INCFILES /dev/null | grep
'\"common.h\"' | sed 's/:.*//g'`"
+# limit our search to files containing common.h or system headers for
+# small performance savings.
+FILES="`grep -I -e '#[[:space:]]*include' $SRCFILES $INCFILES | grep -E
'common.h|<' | sed 's/:.*//g' | sort | uniq`"
FOUND=
-for file in $COMMONSRCS $COMMONINCS ; do
- if test -f "`echo $file | sed 's/\.c$/\.l/g'`" ; then
- continue
+for file in $FILES ; do
+
+ # test files that include common.h
+ if test ! "x`grep -I -e '#[[:space:]]*include' $file | grep
'\"common.h\"'`" = "x" ; then
+ # common.h is first?
+ MATCH="`grep -n -I -e '#[[:space:]]*include' $file /dev/null | head -n
1 | grep -v '\"common.h\"'`"
+ if test ! "x$MATCH" = "x" ; then
+ echo "ERROR: common.h include needs to be moved before: $MATCH"
+ FOUND=1
+ continue
+ fi
fi
- MATCH="`grep '#[[:space:]]*include' $file /dev/null | head -n 1 | grep -v
'\"common.h\"' | sed 's/:.*//g'`"
- if test ! "x$MATCH" = "x" ; then
- if test "x`head $file | grep BRL-CAD`" = "x" ; then
- # not a BRL-CAD file (or it's lexer-generated) , so skip it
+
+ # test files that include system headers
+ if test ! "x`grep -I -e '#[[:space:]]*include' $file | grep '<'`" = "x" ;
then
+ # non-system header is first?
+ MATCH="`grep -n -I -e '#[[:space:]]*include' $file /dev/null | head -n
1 | grep -v '\"'`"
+ if test ! "x$MATCH" = "x" ; then
+ echo "ERROR: common.h needs to be included before: $MATCH"
+ # FOUND=1
continue
fi
- echo "ERROR: Header (common.h) out of order: $MATCH"
- FOUND=1
fi
+
done
if test "x$FOUND" = "x" ; then
echo "-> common.h check succeeded"
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits