From: Jim Meyering Date: Tue, 23 Aug 2005 16:52:09 +0000 (+0000) Subject: (sc_useless_cpp_parens): New rule. X-Git-Tag: v5.90~337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a60996e13c58cf2389ce31ed92ace6dd591ea32a;p=thirdparty%2Fcoreutils.git (sc_useless_cpp_parens): New rule. (syntax-check-rules): Add it. --- diff --git a/Makefile.maint b/Makefile.maint index 3898dab414..f2b07a84d0 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -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.