Eric Blake wrote:
On 03/25/2010 02:22 AM, Jim Meyering wrote:
>> -# Using test's -a operator is not portable.
>> -sc_prohibit_test_minus_a:
>> +# Using test's -a and -o operators is not portable.
>> +sc_prohibit_test_minus_ao:
>> @re='\<test .+ -[a] ' \
>> msg='use "test C1 && test C2, not "test C1 -''a
C2"' \
>> $(_prohibit_regexp)
>> + @re='\<test .+ -[o] ' \
>> + msg='use "test C1 || test C2, not "test C1 -''o
C2"' \
>> + $(_prohibit_regexp)
>
> I actually wrote a separate target before I saw you'd done it. Seeing
> yours, I realize that both tests do belong in the same rule, but would
> prefer the efficiency of combining the searches, so that we don't make
> two passes through all sources, when one will do. Then the only trick is
> to produce a combined diagnostic. Maybe like this (thought the resulting
> line is too long -- for a diagnostic it's not a big deal).
Agreed, since the diagnostic never prints on a successful run :)
>
> _m1 = use "test C1 && test C2, not "test C1 -''a C2"
> _m2 = use "test C1 || test C2, not "test C1 -''o C2"
>
> sc_prohibit_test_minus_ao:
> @re='\<test .+ -[ao] ' \
> msg='$(_m1); $(_m2)' \
> $(_prohibit_regexp)
I like this change. ACK to your tweaks to my patch, and looking forward
to the push.
I've pushed this:
From 271945a148395230066a61b426437b99ca39091b Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake(a)redhat.com>
Date: Fri, 26 Mar 2010 08:41:05 +0100
Subject: [PATCH] maint: update syntax-check rule to also catch test's -o operator
* cfg.mk (sc_prohibit_test_minus_a): Rename...
(sc_prohibit_test_minus_ao): ...and flag '-o', too.
---
cfg.mk | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index bf5eae3..7fdb069 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -270,10 +270,12 @@ sc_preprocessor_indentation:
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
fi
-# Using test's -a operator is not portable.
-sc_prohibit_test_minus_a:
- @re='\<test .+ -[a] ' \
- msg='use "test C1 && test C2, not "test C1 -''a
C2"' \
+_m1 = use "test C1 && test C2", not "test C1 -''a
C2"
+_m2 = use "test C1 || test C2", not "test C1 -''o C2"
+# Using test's -a and -o operators is not portable.
+sc_prohibit_test_minus_ao:
+ @re='\<test .+ -[ao] ' \
+ msg='$(_m1); $(_m2)' \
$(_prohibit_regexp)
sc_copyright_format:
--
1.7.0.3.448.g82eeb