Uploaded image for project: 'Apache HAWQ'
  1. Apache HAWQ
  2. HAWQ-1181 Improve the code quality of Apache HAWQ.
  3. HAWQ-1190

Fix "Wtypedef-redefinition, Wconstant-logical-operand, Wmemsize-comparison, Wnull-dereference, Wpointer-sign, Wint-conversion" compile warnings.

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.1.0.0-incubating
    • Build
    • None

    Description

      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 -lcurl  -I. -I../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o pxf.o pxf.c
      clang: warning: -lcurl: 'linker' input unused
      In file included from pxf.c:21:
      In file included from ./common.h:31:
      ../../../src/include/access/fileam.h:75:33: warning: redefinition of typedef 'ExternalSelectDesc' is a C11 feature [-Wtypedef-redefinition]
      typedef ExternalSelectDescData *ExternalSelectDesc;
                                      ^
      ../../../src/include/access/extprotocol.h:37:40: note: previous definition is here
      typedef struct ExternalSelectDescData *ExternalSelectDesc;
                                             ^
      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 -I../../../../src/backend/gp_libpq_fe  -I../../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o datetime.o datetime.c
      datetime.c:3205:27: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
                                                      tmask = (DTK_DATE_M || DTK_TIME_M);
                                                                          ^  ~~~~~~~~~~
      datetime.c:3205:27: note: use '|' for a bitwise operation
                                                      tmask = (DTK_DATE_M || DTK_TIME_M);
                                                                          ^~
                                                                          |
      1 warning generated.
      
      segadmin.c:112:13: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
              if ((flags && STANDBY_ONLY) == STANDBY_ONLY)
                         ^  ~~~~~~~~~~~~
      segadmin.c:112:13: note: use '&' for a bitwise operation
              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 -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS  -DFRONTEND -I../include -I../../../../src/interfaces/ecpg/include -I../../../../src/include/utils -I../../../../src/interfaces/libpq -I../../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -DSO_MAJOR_VERSION=3  -c -o interval.o interval.c
      interval.c:609:27: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
                                                      tmask = (DTK_DATE_M || DTK_TIME_M);
                                                                          ^  ~~~~~~~~~~
      interval.c:609:27: note: use '|' for a bitwise operation
                                                      tmask = (DTK_DATE_M || DTK_TIME_M);
                                                                          ^~
                                                                          |
      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 -I../../../../src/backend/gp_libpq_fe  -I../../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o pgstatfuncs.o pgstatfuncs.c
      pgstatfuncs.c:464:33: warning: size argument in 'memcmp' call is a comparison [-Wmemsize-comparison]
                                                 sizeof(zero_clientaddr) == 0))
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      pgstatfuncs.c:463:8: note: did you mean to compare the result of 'memcmp' instead?
                              if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr,
                                  ^
      pgstatfuncs.c:464:9: note: explicitly cast the argument to size_t to silence this warning
                                                 sizeof(zero_clientaddr) == 0))
                                                 ^
                                                 (size_t)(                   )
      pgstatfuncs.c:722:31: warning: size argument in 'memcmp' call is a comparison [-Wmemsize-comparison]
                                 sizeof(zero_clientaddr) == 0))
                                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      pgstatfuncs.c:721:6: note: did you mean to compare the result of 'memcmp' instead?
              if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr,
                  ^
      pgstatfuncs.c:722:7: note: explicitly cast the argument to size_t to silence this warning
                                 sizeof(zero_clientaddr) == 0))
                                 ^
                                 (size_t)(                   )
      pgstatfuncs.c:768:31: warning: size argument in 'memcmp' call is a comparison [-Wmemsize-comparison]
                                 sizeof(zero_clientaddr) == 0))
                                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      pgstatfuncs.c:767:6: note: did you mean to compare the result of 'memcmp' instead?
              if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr,
                  ^
      pgstatfuncs.c:768:7: note: explicitly cast the argument to size_t to silence this warning
                                 sizeof(zero_clientaddr) == 0))
                                 ^
                                 (size_t)(                   )
      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. -I../../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o faultinjector.o faultinjector.c
      faultinjector.c:788:4: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
                              *(int *) 0 = 1234;
                              ^~~~~~~~~~
      faultinjector.c:788:4: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
      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 -I../../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o mcxt.o mcxt.c
      mcxt.c:462:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
                      *(int *) NULL = errorcode;
                      ^~~~~~~~~~~~~
      mcxt.c:462:3: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
      
      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/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o memprot.o memprot.c
      memprot.c:302:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
                      *(int *) NULL = ec;
                      ^~~~~~~~~~~~~
      memprot.c:302:3: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
      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 -I include -I../../../src/backend/gp_libpq_fe -I../../../src/include  -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o resqueuemanager.o resqueuemanager.c
      resqueuemanager.c:489:15: warning: passing 'int32_t *' (aka 'int *') to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign
            [-Wpointer-sign]
                                                                                                        &(queue->ClusterMemoryMB));
                                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../src/include/resourcemanager/utils/simplestring.h:89:63: note: passing argument to parameter 'value' here
      int  SimpleStringToStorageSizeMB(SimpStringPtr str, uint32_t *value);
                                                                    ^
      resqueuemanager.c:520:15: warning: passing 'int32_t *' (aka 'int *') to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign
            [-Wpointer-sign]
                                                                                                        &(queue->SegResourceQuotaMemoryMB));
                                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../src/include/resourcemanager/utils/simplestring.h:89:63: note: passing argument to parameter 'value' here
      int  SimpleStringToStorageSizeMB(SimpStringPtr str, uint32_t *value);
                                                                    ^
      resqueuemanager.c:849:7: warning: passing 'int32_t *' (aka 'int *') to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
                                                      &(shadowqueinfo->SegResourceQuotaMemoryMB));
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../src/include/resourcemanager/utils/simplestring.h:89:63: note: passing argument to parameter 'value' here
      int  SimpleStringToStorageSizeMB(SimpStringPtr str, uint32_t *value);
                                                                    ^
      
      resourcemanager.c:1035:13: warning: passing 'int32_t *' (aka 'int *') to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign
            [-Wpointer-sign]
                                                                                        &(DRMGlobalInstance->SegmentMemoryMB));
                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      guc.c:13690:53: warning: passing 'int32_t *' (aka 'int *') to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
                      parseres = SimpleStringToStorageSizeMB(&valuestr, &newvalmb);
                                                                        ^~~~~~~~~
      ../../../../src/include/resourcemanager/utils/simplestring.h:89:63: note: passing argument to parameter 'value' here
      int  SimpleStringToStorageSizeMB(SimpStringPtr str, uint32_t *value);
                                                                    ^
      
      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/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o cdbpersistentfilespace.o cdbpersistentfilespace.c
      cdbpersistentfilespace.c:615:58: warning: incompatible pointer to integer conversion passing 'int64 *' (aka 'long *') to parameter of type 'int64' (aka 'long'); dereference with * [-Wint-conversion]
              mmxlog_log_create_filespace(filespaceOid,persistentTid, persistentSerialNum);
                                                                      ^~~~~~~~~~~~~~~~~~~
                                                                      *
      ../../../src/include/access/xlogmm.h:154:88: note: passing argument to parameter 'persistentSerialNum' here
      extern void mmxlog_log_create_filespace(Oid filespace,ItemPointer persistentTid, int64 persistentSerialNum);
                                                                                             ^
      1 warning generated.
      
      
      cdbpersistentrelfile.c:249:22: warning: incompatible pointer to integer conversion passing 'int64 *' (aka 'long *') to parameter of type 'int64' (aka 'long'); dereference with * [-Wint-conversion]
                                                      persistentTid, serialNum);
                                                                     ^~~~~~~~~
                                                                     *
      ../../../src/include/access/xlogmm.h:159:76: note: passing argument to parameter 'persistentSerialNum' here
                                                                                        Oid relfilenode, int32 segnum,ItemPointer persistentTid, int64 persistentSerialNum);
                                                                                                                                                       ^
      1 warnings generated.
      
      cdbpersistentdatabase.c:615:19: warning: incompatible pointer to integer conversion passing 'int64 *' (aka 'long *') to parameter of type 'int64' (aka 'long'); dereference with * [-Wint-conversion]
                              persistentTid, persistentSerialNum);
                                             ^~~~~~~~~~~~~~~~~~~
                                             *
      ../../../src/include/access/xlogmm.h:156:102: note: passing argument to parameter 'persistentSerialNum' here
      extern void mmxlog_log_create_database(Oid tablespace, Oid database,ItemPointer persistentTid, int64 persistentSerialNum);
                                                                                                           ^
      cdbpersistentdatabase.c:1294:26: warning: incompatible pointer to integer conversion passing 'int64 *' (aka 'long *') to parameter of type 'int64' (aka 'long'); dereference with * [-Wint-conversion]
                                                                 persistentTid, persistentSerialNum);
                                                                                ^~~~~~~~~~~~~~~~~~~
                                                                                *
      ../../../src/include/access/xlogmm.h:156:102: note: passing argument to parameter 'persistentSerialNum' here
      extern void mmxlog_log_create_database(Oid tablespace, Oid database,ItemPointer persistentTid, int64 persistentSerialNum);
                                                                                                           ^
      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/tmp2/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/Users/wuhong/Desktop/tmp/tmp2/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include  -c -o cdbpersistenttablespace.o cdbpersistenttablespace.c
      cdbpersistenttablespace.c:715:22: warning: incompatible pointer to integer conversion passing 'int64 *' (aka 'long *') to parameter of type 'int64' (aka 'long'); dereference with * [-Wint-conversion]
                                                      persistentTid, persistentSerialNum);
                                                                     ^~~~~~~~~~~~~~~~~~~
                                                                     *
      ../../../src/include/access/xlogmm.h:155:105: note: passing argument to parameter 'persistentSerialNum' here
      extern void mmxlog_log_create_tablespace(Oid filespace, Oid tablespace,ItemPointer persistentTid, int64 persistentSerialNum);
                                                                                                              ^
      1 warning generated.
      
      

      Attachments

        Issue Links

          Activity

            People

              xunzhang Hong Wu
              xunzhang Hong Wu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: