(sc_useless_cpp_parens): New rule.
authorJim Meyering <jim@meyering.net>
Tue, 23 Aug 2005 16:52:09 +0000 (16:52 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 23 Aug 2005 16:52:09 +0000 (16:52 +0000)
(syntax-check-rules): Add it.

Makefile.maint

index 3898dab..f2b07a8 100644 (file)
@@ -84,7 +84,8 @@ syntax-check-rules = \
   sc_system_h_headers \
   sc_tight_scope \
   sc_trailing_blank \
-  sc_unmarked_diagnostics
+  sc_unmarked_diagnostics \
+  sc_useless_cpp_parens
 
 syntax-check: $(syntax-check-rules)
 #      @grep -E '#  *include <(limits|std(def|arg|bool))\.h>'          \
@@ -248,6 +249,15 @@ sc_unmarked_diagnostics:
          { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
            exit 1; } || :
 
+# Avoid useless parentheses like those in this example:
+# #if defined (SYMBOL) || defined (SYM2)
+sc_useless_cpp_parens:
+       @( $(CVS_LIST) ) > /dev/null 2>&1 || : &&                       \
+         grep '^# *if .*defined *('                                    \
+            $$($(CVS_LIST) | grep -vEf .x-$@ ) &&                      \
+         { echo '$(ME): found useless parentheses in cpp directive'    \
+               1>&2; exit 1; } || :
+
 # Ensure that date's --help output stays in sync with the info
 # documentation for GNU strftime.  The only exception is %N,
 # which date accepts but GNU strftime does not.