You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "hongwu (JIRA)" <ji...@apache.org> on 2016/12/03 07:19:58 UTC

[jira] [Updated] (HAWQ-1188) Fix "-Wtautological-constant-out-of-range-compare, -Wtautological-compare, -Wpointer-bool-conversion, -Wnon-literal-null-conversion, -Wincompatible-pointer-types, -Wlogical-not-parentheses" compile warnings under osx.

     [ https://issues.apache.org/jira/browse/HAWQ-1188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

hongwu updated HAWQ-1188:
-------------------------
    Summary: Fix "-Wtautological-constant-out-of-range-compare, -Wtautological-compare, -Wpointer-bool-conversion, -Wnon-literal-null-conversion, -Wincompatible-pointer-types, -Wlogical-not-parentheses" compile warnings under osx.  (was: Fix "-Wtautological-constant-out-of-range-compare, -Wtautological-compare, -Wpointer-bool-conversion, -Wnon-literal-null-conversion, -Wincompatible-pointer-types, -Wformat-extra-args, -Wformat, -Wlogical-not-parentheses" compile warnings under osx.)

> Fix "-Wtautological-constant-out-of-range-compare, -Wtautological-compare, -Wpointer-bool-conversion, -Wnon-literal-null-conversion, -Wincompatible-pointer-types, -Wlogical-not-parentheses" compile warnings under osx.
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HAWQ-1188
>                 URL: https://issues.apache.org/jira/browse/HAWQ-1188
>             Project: Apache HAWQ
>          Issue Type: Improvement
>          Components: Build
>            Reporter: hongwu
>            Assignee: hongwu
>
> {code}
> fe-exec.c:2389:27: warning: comparison of constant 8 with expression of type 'ExecStatusType' is always false [-Wtautological-constant-out-of-range-compare]
>         if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
>                           ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -DUNSAFE_STAT_OK -I. -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -I../../../src/port  -c -o fe-exec.o fe-exec.c
> fe-exec.c:2671:32: warning: comparison of constant 8 with expression of type 'ExecStatusType' is always false [-Wtautological-constant-out-of-range-compare]
>         if ((int)status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
>                                ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> md.c:1289:77: warning: comparison of constant 0 with boolean expression is always false [-Wtautological-constant-out-of-range-compare]
>                         if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0)
>                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
> 2 warnings generated.
> segadmin.c:112:30: warning: comparison of constant 32 with boolean expression is always false [-Wtautological-constant-out-of-range-compare]
>         if ((flags && STANDBY_ONLY) == STANDBY_ONLY)
>             ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -I../../../src/interfaces/libpq -I../../../src/backend/gp_libpq_fe -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o cdbgang.o cdbgang.c
> cdbgang.c:447:61: warning: comparison of constant 10 with expression of type 'GangType' (aka 'enum GangType') is always false [-Wtautological-constant-out-of-range-compare]
>         if (gp->gang_id < 1 || gp->gang_id > 100000000 || gp->type > 10 || gp->size > 100000)
>                                                           ~~~~~~~~ ^ ~~
> 1 warning generated.
> fe-exec.c:2971:20: warning: address of array 'res->cmdStatus' will always evaluate to 'true' [-Wpointer-bool-conversion]
>         if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
>                     ~~~~~~^~~~~~~~~
> fe-exec.c:2995:9: warning: address of array 'res->cmdStatus' will always evaluate to 'true' [-Wpointer-bool-conversion]
>                 !res->cmdStatus ||
>                 ~~~~~~^~~~~~~~~
> 3 warnings generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -I../../../src/interfaces/libpq -I../../../src/backend/gp_libpq_fe -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o cdbsreh.o cdbsreh.c
> cdbsreh.c:350:14: warning: address of array 'cdbsreh->filename' will always evaluate to 'true' [-Wpointer-bool-conversion]
>         if(cdbsreh->filename)
>         ~~ ~~~~~~~~~^~~~~~~~
> 1 warning generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS  -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-exec.o fe-exec.c
> fe-exec.c:2389:13: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
>         if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
>             ~~~~~~ ^ ~
> fe-exec.c:2389:27: warning: comparison of constant 8 with expression of type 'ExecStatusType' is always false [-Wtautological-constant-out-of-range-compare]
>         if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
>                           ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fe-exec.c:2689:20: warning: address of array 'res->cmdStatus' will always evaluate to 'true' [-Wpointer-bool-conversion]
>         if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
>                     ~~~~~~^~~~~~~~~
> fe-exec.c:2713:9: warning: address of array 'res->cmdStatus' will always evaluate to 'true' [-Wpointer-bool-conversion]
>                 !res->cmdStatus ||
>                 ~~~~~~^~~~~~~~~
> 4 warnings generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -I../../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o md.o md.c
> md.c:1289:8: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
>                         if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0)
>                             ^                                                                    ~
> md.c:1289:8: note: add parentheses after the '!' to evaluate the comparison first
>                         if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0)
>                             ^
>                              (                                                                      )
> md.c:1289:8: note: add parentheses around left hand side expression to silence this warning
>                         if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0)
>                             ^
>                             (                                                                   )
> md.c:1289:77: warning: comparison of constant 0 with boolean expression is always false [-Wtautological-constant-out-of-range-compare]
>                         if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0)
>                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
> 2 warnings generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS  -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-exec.o fe-exec.c
> fe-exec.c:2389:13: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
>         if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
>             ~~~~~~ ^ ~
> fe-exec.c:2389:27: warning: comparison of constant 8 with expression of type 'ExecStatusType' is always false [-Wtautological-constant-out-of-range-compare]
>         if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
>                           ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fe-exec.c:2689:20: warning: address of array 'res->cmdStatus' will always evaluate to 'true' [-Wpointer-bool-conversion]
>         if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
>                     ~~~~~~^~~~~~~~~
> fe-exec.c:2713:9: warning: address of array 'res->cmdStatus' will always evaluate to 'true' [-Wpointer-bool-conversion]
>                 !res->cmdStatus ||
>                 ~~~~~~^~~~~~~~~
> 4 warnings generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o heap.o heap.c
> heap.c:910:13: warning: expression which evaluates to zero treated as a null pointer constant of type 'HeapTuple' (aka 'struct HeapTupleData *') [-Wnon-literal-null-conversion]
>                                                         rel, InvalidOid);
>                                                              ^~~~~~~~~~
> ../../../src/include/postgres_ext.h:34:21: note: expanded from macro 'InvalidOid'
> #define InvalidOid              ((Oid) 0)
>                                 ^~~~~~~~~
> 1 warning generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -DUNSAFE_STAT_OK -I. -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -I../../../src/port  -c -o fe-connect.o fe-connect.c
> fe-connect.c:439:10: warning: expression which evaluates to zero treated as a null pointer constant of type 'PGconn *' (aka 'struct pg_conn *') [-Wnon-literal-null-conversion]
>                 return false;
>                        ^~~~~
> ../../../src/include/c.h:215:15: note: expanded from macro 'false'
> #define false   ((bool) 0)
>                 ^~~~~~~~~~
> 1 warning generated.
> gcc -O3 -std=gnu99  -Wall -Wmissing-prototypes -Wpointer-arith  -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/Cellar/curl/7.49.1/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS  -DFRONTEND -DUNSAFE_STAT_OK -I. -I../../../src/include  -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -I../../../src/port -I../../../src/port -DSO_MAJOR_VERSION=5  -c -o fe-connect.o fe-connect.c
> fe-connect.c:449:10: warning: expression which evaluates to zero treated as a null pointer constant of type 'PGconn *' (aka 'struct pg_conn *') [-Wnon-literal-null-conversion]
>                 return false;
>                        ^~~~~
> ../../../src/include/c.h:215:15: note: expanded from macro 'false'
> #define false   ((bool) 0)
>                 ^~~~~~~~~~
> 1 warning generated.
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)