powa-team / pg_qualstats

A PostgreSQL extension for collecting statistics about predicates, helping find what indices are missing
Other
272 stars 26 forks source link

Remove extraneous parentheses to avoid clang warning #21

Closed anayrat closed 6 years ago

anayrat commented 6 years ago

Hello,

I tried to compile pg_qualstats on debian stretch, which seems to use clang by default. clang report this warning:

[...]
/usr/bin/clang-3.9 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o pg_qualstats.bc pg_qualstats.c
pg_qualstats.c:1520:27: warning: equality comparison with extraneous parentheses
      [-Wparentheses-equality]
                                if ((boolexpr->boolop == AND_EXPR))
                                     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
pg_qualstats.c:1520:27: note: remove extraneous parentheses around the comparison to silence this
      warning
                                if ((boolexpr->boolop == AND_EXPR))
                                    ~                 ^          ~
pg_qualstats.c:1520:27: note: use '=' to turn this equality comparison into an assignment
                                if ((boolexpr->boolop == AND_EXPR))
                                                      ^~
                                                      =
rjuju commented 6 years ago

Yes, I've also seen those warning since some gcc version (I'm currently using gcc 7.3.0).

Thanks!