]> granicus.if.org Git - postgresql/commitdiff
Improve pginclude tools to process include file usage by other include files.
authorBruce Momjian <bruce@momjian.us>
Thu, 13 Jul 2006 16:39:20 +0000 (16:39 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 13 Jul 2006 16:39:20 +0000 (16:39 +0000)
src/tools/pginclude/pgdefine
src/tools/pginclude/pgrminclude

index 41e71b452dc9f2973f64fd53c53cb29b68d01ced..52a775e163cd6ff412ee1a853745d030c09b0e1e 100755 (executable)
@@ -1,14 +1,19 @@
 :
 # create macro calls for all defines in the file
 
-# $PostgreSQL: pgsql/src/tools/pginclude/pgdefine,v 1.3 2006/03/11 04:38:42 momjian Exp $
+# $PostgreSQL: pgsql/src/tools/pginclude/pgdefine,v 1.4 2006/07/13 16:39:20 momjian Exp $
 
 trap "rm -f /tmp/$$" 0 1 2 3 15
 for FILE
 do
        cat "$FILE" | grep "^#define" >/tmp/$$
-       cat /tmp/$$ | sed -n 's/^#define[       ][      ]*\([a-zA-Z0-9_]*\)[    ][      ]*[^    ].*$/(void)\1;/p'
-       cat /tmp/$$ | sed -n 's/^#define[       ][      ]*\([a-zA-Z0-9_]*([^)]*)\).*$/(=void)\1;/p' |
+       cat /tmp/$$ | sed -n 's/^#define[       ][      ]*\([a-zA-Z0-9_]*\)[    ][      ]*[^    ].*\\\\$/\1;/p'
+       cat /tmp/$$ | sed -n 's/^#define[       ][      ]*\([a-zA-Z0-9_]*\)[    ][      ]*[^    ].*[^\\\\]$/(void)\1;/p'
+
+       (
+               cat /tmp/$$ | sed -n 's/^#define[       ][      ]*\([a-zA-Z0-9_]*([^)]*)\).*\\\\$/\1;/p'
+               cat /tmp/$$ | sed -n 's/^#define[       ][      ]*\([a-zA-Z0-9_]*([^)]*)\).*[^\\\\]$/(=void)\1;/p'
+       ) |
        sed 's/([a-zA-Z0-9_ ][a-zA-Z0-9_ ]*)/(0)/g' |
        sed 's/([a-zA-Z0-9_ ]*,/(0,/g' |
        sed 's/,[a-zA-Z0-9_ ]*,/,0,/g' |
index 33dd11eeff8f206be6c35dba21fac061f74141bf..f1cf26091e73aab229e6ce25c0c674dbe52d3998 100755 (executable)
@@ -1,7 +1,7 @@
 :
 # remove extra #include's
 
-# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.13 2006/07/12 16:28:27 momjian Exp $
+# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.14 2006/07/13 16:39:20 momjian Exp $
 
 trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
 find . \( -name CVS -a -prune \) -o -type f -name '*.[ch]' -print | 
@@ -71,6 +71,8 @@ do
                                cat /tmp/$$b
                                cat /tmp/$$.c
                        fi
+                       grep -v '^#include[     ][      ]*[<"]'"$INCLUDE"'[>"]' \
+                               "$FILE" >/tmp/$$b
                        mv /tmp/$$b "$FILE"
                fi
        done