diff options
-rwxr-xr-x | lib/sbin/cpp.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sbin/cpp.pl b/lib/sbin/cpp.pl index 4cfccb65..375abad0 100755 --- a/lib/sbin/cpp.pl +++ b/lib/sbin/cpp.pl @@ -806,6 +806,13 @@ sub ExpandMacro my $retcode = 0; my @arguments = &SplitArgs($args); + # SplitArgs returns one (empty) argument for macros without arguments, + # because it cannot distinguish between no arguments and one empty argument. + if (@{$defines{$macro}{"ARGS"}} == 0) + { + @arguments = (); + } + my $outstring = $defines{$macro}{"BODY"}; if($macro eq "__FILE__") @@ -949,11 +956,8 @@ sub SplitArgs push(@thistoken, $splitargs[$pos]); } - # Push any remaining token - if(@thistoken > 0) - { - push(@outargs, join("",@thistoken)); - } + # Push the remaining token + push(@outargs, join("",@thistoken)); return @outargs; } |