X11 generator: avoid extraneous parens in conditionals.

This is to avoid complaints from clang of the form:

wireshark/epan/dissectors/x11-extension-implementation.h:17021:18: error:
equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
        if ((f_class_id == 0)) {
             ~~~~~~~~~~~^~~~

Change-Id: I91d629ad47677b71909d7da517c4a6198c276186
Reviewed-on: https://code.wireshark.org/review/11186
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Jeff Morriss 2015-10-20 16:14:21 -04:00 committed by Gerald Combs
parent 9768a3e8a0
commit 4a5977b587
3 changed files with 199 additions and 186 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It was automatically generated by ../../tools/process-x11-xcb.pl
using mesa version 11.0-branchpoint-1337-gc188235 */
using mesa version 11.0-branchpoint-1379-g6f39546 */
/*
* Copyright 2008, 2009, 2013, 2014 Open Text Corporation <pharris[AT]opentext.com>
*

View File

@ -902,17 +902,30 @@ sub dissect_element($$$$$;$$)
for my $foo (keys %{$enum{$enum_name{$enum_ref}}{rbit}}) { say "'$foo'"; }
die ("Field '$field' not found in '$enum_ref'");
}
push @test , "($switchon & (1U << $bit))";
push @test , "$switchon & (1U << $bit)";
} else {
my $val = $enum{$enum_name{$enum_ref}}{rvalue}{$field};
if (! defined($val)) {
for my $foo (keys %{$enum{$enum_name{$enum_ref}}{rvalue}}) { say "'$foo'"; }
die ("Field '$field' not found in '$enum_ref'");
}
push @test , "($switchon == $val)";
push @test , "$switchon == $val";
}
}
my $list = join ' || ', @test;
if (@test > 1) {
# We have more than one conditional, add parentheses to them.
# We don't add parentheses to all the conditionals because
# clang complains about the extra parens if you do "if ((x == y))".
my @tests_with_parens;
foreach my $conditional (@test) {
push @tests_with_parens, "($conditional)";
}
@test = @tests_with_parens;
}
my $list = join ' || ', @test;
say $impl $indent."if ($list) {";
my $vp = $varpat;