Repository: incubator-hawq
Updated Branches:
  refs/heads/master 8e8194cda -> 01ce2083f


HAWQ-1184. Fix risky "-Wshift-negative-value, -Wparentheses-equality, 
-Wtautological-compare" types of compile warnings under osx.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/01ce2083
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/01ce2083
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/01ce2083

Branch: refs/heads/master
Commit: 01ce2083f3fde2b7c68618ee363e03fa9f2f03fe
Parents: 8e8194c
Author: xunzhang <xunzhang...@gmail.com>
Authored: Thu Dec 1 23:30:01 2016 +0800
Committer: xunzhang <xunzhang...@gmail.com>
Committed: Fri Dec 2 14:29:24 2016 +0800

----------------------------------------------------------------------
 src/backend/access/external/url.c          |  3 ++-
 src/backend/catalog/heap.c                 |  2 +-
 src/backend/catalog/pg_filesystem.c        |  4 ++--
 src/backend/executor/execBitmapTableScan.c |  4 ++--
 src/backend/optimizer/plan/planner.c       |  4 ++--
 src/backend/regex/regc_locale.c            | 22 +++++++++++-----------
 src/bin/gpfdist/src/gpfdist/gpfdist.c      |  2 +-
 7 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/backend/access/external/url.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/url.c 
b/src/backend/access/external/url.c
index 97cdb92..7f586db 100644
--- a/src/backend/access/external/url.c
+++ b/src/backend/access/external/url.c
@@ -54,6 +54,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
+#include <stdint.h>
 
 #include <curl/curl.h>
 
@@ -1561,7 +1562,7 @@ static size_t gp_proto1_read(char *buf, int bufsz, 
URL_FILE *file, CopyState pst
                         */
                        memcpy(&line_number, curl->in.ptr + curl->in.bot, len);
                        line_number = local_ntohll(line_number);
-                       pstate->cur_lineno = line_number ? line_number - 1 : 
(int64) - 1 << 63;
+                       pstate->cur_lineno = line_number ? line_number - 1 : 
INT64_MIN;
                        curl->in.bot += 8;
                        Assert(curl->in.bot <= curl->in.top);
                        continue;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/backend/catalog/heap.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index c61a2e1..3fcff53 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -1612,7 +1612,7 @@ heap_create_with_catalog(const char *relname,
                IsNormalProcessingMode() &&
         (Gp_role == GP_ROLE_DISPATCH))
        {
-               if ((relstorage == RELSTORAGE_PARQUET))
+               if (relstorage == RELSTORAGE_PARQUET)
                        ereport(ERROR,
                                        
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                         errmsg(

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/backend/catalog/pg_filesystem.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/pg_filesystem.c 
b/src/backend/catalog/pg_filesystem.c
index b0a4315..b2ed458 100644
--- a/src/backend/catalog/pg_filesystem.c
+++ b/src/backend/catalog/pg_filesystem.c
@@ -384,7 +384,7 @@ FileSystemGetNameByOid(Oid  fsysOid)
 
 char *fsys_func_type_to_name(FileSystemFuncType ftype)
 {
-       if(ftype < 0 || ftype >= FSYS_FUNC_TOTALNUM)
+       if (ftype < FSYS_FUNC_CONNECT || ftype >= FSYS_FUNC_TOTALNUM)
        {
                elog(ERROR, "internal error in 
pg_filesystem:func_type_to_name");
                return NULL;
@@ -394,7 +394,7 @@ char *fsys_func_type_to_name(FileSystemFuncType ftype)
 
 int fsys_func_type_to_attnum(FileSystemFuncType ftype)
 {
-       if(ftype < 0 || ftype >= FSYS_FUNC_TOTALNUM)
+       if (ftype < FSYS_FUNC_CONNECT || ftype >= FSYS_FUNC_TOTALNUM)
        {
                elog(ERROR, "internal error in 
pg_filesystem:func_type_to_attnum");
                return -1;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/backend/executor/execBitmapTableScan.c
----------------------------------------------------------------------
diff --git a/src/backend/executor/execBitmapTableScan.c 
b/src/backend/executor/execBitmapTableScan.c
index 066624e..e68ad6d 100644
--- a/src/backend/executor/execBitmapTableScan.c
+++ b/src/backend/executor/execBitmapTableScan.c
@@ -67,8 +67,8 @@ getBitmapTableScanMethod(TableType tableType)
 
        /* COMPILE_ASSERT(ARRAY_SIZE(scanMethods) == TableTypeInvalid); */
 
-       if (tableType < 0 && tableType >= TableTypeInvalid)
-       {
+       if (tableType < TableTypeHeap || tableType >= TableTypeInvalid)
+    {
                return NULL;
        }
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/backend/optimizer/plan/planner.c
----------------------------------------------------------------------
diff --git a/src/backend/optimizer/plan/planner.c 
b/src/backend/optimizer/plan/planner.c
index 3006d33..950943a 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -675,8 +675,8 @@ resource_negotiator(Query *parse, int cursorOptions, 
ParamListInfo boundParams,
       pfree(allocResult);
     }else{
                find_udf(my_parse, &udf_context);
-               if(udf_context.udf_exist){
-                       if ((resourceLife == QRL_ONCE)) {
+               if (udf_context.udf_exist) {
+                 if (resourceLife == QRL_ONCE) {
                                int64 mincost = min_cost_for_each_query;
                                mincost <<= 20;
                                int avgSliceNum = 3;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/backend/regex/regc_locale.c
----------------------------------------------------------------------
diff --git a/src/backend/regex/regc_locale.c b/src/backend/regex/regc_locale.c
index 28f5e7c..339380e 100644
--- a/src/backend/regex/regc_locale.c
+++ b/src/backend/regex/regc_locale.c
@@ -355,61 +355,61 @@ static const struct cname
 static int
 pg_wc_isdigit(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char) c));
+       return (c <= UCHAR_MAX && isdigit((unsigned char) c));
 }
 
 static int
 pg_wc_isalpha(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isalpha((unsigned char) c));
+       return (c <= UCHAR_MAX && isalpha((unsigned char) c));
 }
 
 static int
 pg_wc_isalnum(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isalnum((unsigned char) c));
+       return (c <= UCHAR_MAX && isalnum((unsigned char) c));
 }
 
 static int
 pg_wc_isupper(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char) c));
+       return (c <= UCHAR_MAX && isupper((unsigned char) c));
 }
 
 static int
 pg_wc_islower(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char) c));
+       return (c <= UCHAR_MAX && islower((unsigned char) c));
 }
 
 static int
 pg_wc_isgraph(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c));
+       return (c <= UCHAR_MAX && isgraph((unsigned char) c));
 }
 
 static int
 pg_wc_isprint(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
+       return (c <= UCHAR_MAX && isprint((unsigned char) c));
 }
 
 static int
 pg_wc_ispunct(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && ispunct((unsigned char) c));
+       return (c <= UCHAR_MAX && ispunct((unsigned char) c));
 }
 
 static int
 pg_wc_isspace(pg_wchar c)
 {
-       return (c >= 0 && c <= UCHAR_MAX && isspace((unsigned char) c));
+       return (c <= UCHAR_MAX && isspace((unsigned char) c));
 }
 
 static pg_wchar
 pg_wc_toupper(pg_wchar c)
 {
-       if (c >= 0 && c <= UCHAR_MAX)
+       if (c <= UCHAR_MAX)
                return toupper((unsigned char) c);
        return c;
 }
@@ -417,7 +417,7 @@ pg_wc_toupper(pg_wchar c)
 static pg_wchar
 pg_wc_tolower(pg_wchar c)
 {
-       if (c >= 0 && c <= UCHAR_MAX)
+       if (c <= UCHAR_MAX)
                return tolower((unsigned char) c);
        return c;
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01ce2083/src/bin/gpfdist/src/gpfdist/gpfdist.c
----------------------------------------------------------------------
diff --git a/src/bin/gpfdist/src/gpfdist/gpfdist.c 
b/src/bin/gpfdist/src/gpfdist/gpfdist.c
index f652f25..5060fa0 100644
--- a/src/bin/gpfdist/src/gpfdist/gpfdist.c
+++ b/src/bin/gpfdist/src/gpfdist/gpfdist.c
@@ -2512,7 +2512,7 @@ static void handle_post_request(request_t *r, int 
header_end)
                ssize_t n;
                size_t buf_space_left = r->in.dbufmax - r->in.dbuftop;
 
-               if (r->in.davailable - buf_space_left >= 0)
+               if (r->in.davailable >= buf_space_left)
                        want = buf_space_left;
                else
                        want = r->in.davailable;

Reply via email to