Author: coke
Date: Thu Feb 21 12:56:01 2008
New Revision: 25948
Modified:
trunk/t/codingstd/c_macro_args.t
Log:
[codingstd]
Instead of writing a single RE that catches the bad case while ignoring the
good cases, remove all the good cases first, and whatever's left is broken.
This brings us to a more reasonable and accurate 50 incorrect #defines.
Modified: trunk/t/codingstd/c_macro_args.t
==============================================================================
--- trunk/t/codingstd/c_macro_args.t (original)
+++ trunk/t/codingstd/c_macro_args.t Thu Feb 21 12:56:01 2008
@@ -59,7 +59,10 @@
# it's referenced in the definition.
if ($definition ne "") {
foreach my $arg (split /\s*,\s*/, $args) {
- if ($definition =~ m/(?<!\(\b)$arg(?!\b\()/) {
+ # eliminate any properly formed usage of the macro arg
+ $definition =~ s/\($arg\)//g;
+ # Any remaining usage must be improper
+ if ($definition =~ m/\b$arg\b/) {
push (@defines, "$path: $macro has unwrapped arg:
$arg\n");
}
}