hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xunzh...@apache.org
Subject [1/2] incubator-hawq git commit: HAWQ-1188. Fix "-Wtautological-constant-out-of-range-compare, -Wtautological-compare, -Wpointer-bool-conversion, -Wnon-literal-null-conversion, -Wincompatible-pointer-types, -Wincompatible-pointer-types-discards-qualifier
Date Wed, 07 Dec 2016 16:10:44 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 85b3455e7 -> 01373b943


HAWQ-1188. Fix "-Wtautological-constant-out-of-range-compare, -Wtautological-compare, -Wpointer-bool-conversion,
-Wnon-literal-null-conversion, -Wincompatible-pointer-types, -Wincompatible-pointer-types-discards-qualifiers,
-Wlogical-not-parentheses" 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/bf3e853b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/bf3e853b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/bf3e853b

Branch: refs/heads/master
Commit: bf3e853b5232d2f1e5b0971bdee7ad1bc5ec3ec9
Parents: 85b3455
Author: xunzhang <xunzhangthu@gmail.com>
Authored: Sat Dec 3 16:14:10 2016 +0800
Committer: xunzhang <xunzhangthu@gmail.com>
Committed: Thu Dec 8 00:10:19 2016 +0800

----------------------------------------------------------------------
 src/backend/catalog/heap.c                              |  2 +-
 src/backend/cdb/cdbgang.c                               |  2 +-
 src/backend/cdb/cdbsreh.c                               |  7 ++-----
 src/backend/gp_libpq_fe/fe-connect.c                    |  2 +-
 src/backend/gp_libpq_fe/fe-exec.c                       |  5 ++---
 src/backend/optimizer/plan/createplan.c                 |  2 +-
 .../resourcemanager/include/utils/memutilities.h        |  2 +-
 .../resourcemanager/include/utils/simplestring.h        |  6 +++---
 src/backend/resourcemanager/utils/memutilities.c        |  2 +-
 src/backend/resourcemanager/utils/simplestring.c        | 12 ++++++------
 src/backend/storage/smgr/md.c                           |  4 ++--
 src/bin/psql/describe.c                                 |  6 +++---
 src/bin/psql/print.c                                    |  4 ++--
 src/bin/psql/print.h                                    |  2 +-
 src/interfaces/libpq/fe-connect.c                       |  2 +-
 src/interfaces/libpq/fe-exec.c                          |  5 ++---
 16 files changed, 30 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/catalog/heap.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 3fcff53..18a8acf 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -907,7 +907,7 @@ void MetaTrackAddObject(Oid		classid,
 	MetaTrackAddUpdInternal(pcqCtx,
 							classid, objoid, relowner,
 							actionname, subtype,
-							rel, InvalidOid);
+							rel, (HeapTuple) InvalidOid);
 
 	caql_endscan(pcqCtx);
 	heap_close(rel, RowExclusiveLock);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/cdb/cdbgang.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbgang.c b/src/backend/cdb/cdbgang.c
index 4a9d7ab..9c8b194 100644
--- a/src/backend/cdb/cdbgang.c
+++ b/src/backend/cdb/cdbgang.c
@@ -444,7 +444,7 @@ disconnectAndDestroyGang(Gang *gp)
 		elog(DEBUG2, "Warning: disconnectAndDestroyGang called on an %s gang",
 			 gp->active ? "active" : "allocated");
 
-	if (gp->gang_id < 1 || gp->gang_id > 100000000 || gp->type > 10 || gp->size
> 100000)
+	if (gp->gang_id < 1 || gp->gang_id > 100000000 || gp->type > GANGTYPE_PRIMARY_WRITER
|| gp->size > 100000)
 	{
 		elog(LOG, "disconnectAndDestroyGang on bad gang");
 		return;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/cdb/cdbsreh.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbsreh.c b/src/backend/cdb/cdbsreh.c
index 87048c3..11d9295 100644
--- a/src/backend/cdb/cdbsreh.c
+++ b/src/backend/cdb/cdbsreh.c
@@ -347,11 +347,8 @@ void InsertIntoErrorTable(CdbSreh *cdbsreh)
 	}
 	
 	/* file name */
-	if(cdbsreh->filename)
-	{
-		values[errtable_filename - 1] = DirectFunctionCall1(textin, CStringGetDatum(cdbsreh->filename));
-		nulls[errtable_filename - 1] = false;
-	}
+	values[errtable_filename - 1] = DirectFunctionCall1(textin, CStringGetDatum(cdbsreh->filename));
+	nulls[errtable_filename - 1] = false;
 
 	/* relation name */
 	values[errtable_relname - 1] = DirectFunctionCall1(textin, CStringGetDatum(cdbsreh->relname));

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/gp_libpq_fe/fe-connect.c
----------------------------------------------------------------------
diff --git a/src/backend/gp_libpq_fe/fe-connect.c b/src/backend/gp_libpq_fe/fe-connect.c
index 3dd4cfb..b41db60 100644
--- a/src/backend/gp_libpq_fe/fe-connect.c
+++ b/src/backend/gp_libpq_fe/fe-connect.c
@@ -436,7 +436,7 @@ PQconnectStartParams(const char **keywords,
 	{
 		conn->status = CONNECTION_BAD;
 		/* errorMessage is already set */
-		return false;
+		return conn;
 	}
 
 	/*

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/gp_libpq_fe/fe-exec.c
----------------------------------------------------------------------
diff --git a/src/backend/gp_libpq_fe/fe-exec.c b/src/backend/gp_libpq_fe/fe-exec.c
index 8382683..86668b1 100644
--- a/src/backend/gp_libpq_fe/fe-exec.c
+++ b/src/backend/gp_libpq_fe/fe-exec.c
@@ -2668,7 +2668,7 @@ PQresultStatus(const PGresult *res)
 char *
 PQresStatus(ExecStatusType status)
 {
-	if ((int)status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
+	if (status < PGRES_EMPTY_QUERY || (unsigned int) status >= sizeof pgresStatus / sizeof
pgresStatus[0])
 		return libpq_gettext("invalid ExecStatusType code");
 	return pgresStatus[status];
 }
@@ -2968,7 +2968,7 @@ PQoidStatus(const PGresult *res)
 
 	size_t		len;
 
-	if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
+	if (!res || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
 		return "";
 
 	len = strspn(res->cmdStatus + 7, "0123456789");
@@ -2992,7 +2992,6 @@ PQoidValue(const PGresult *res)
 	unsigned long result;
 
 	if (!res ||
-		!res->cmdStatus ||
 		strncmp(res->cmdStatus, "INSERT ", 7) != 0 ||
 		res->cmdStatus[7] < '0' ||
 		res->cmdStatus[7] > '9')

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/optimizer/plan/createplan.c
----------------------------------------------------------------------
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index d7efa62..56c6a87 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -1147,7 +1147,7 @@ static char** create_pxf_plan(char **segdb_file_map, RelOptInfo *rel,
int total_
 	if (pxf_enable_filter_pushdown){
 		segdb_work_map = map_hddata_2gp_segments(uri_str,
 											 total_segs, segs_participating,
-											 relation, ctx->root->parse->jointree->quals);
+											 relation, (List *) ctx->root->parse->jointree->quals);
 	}else{
 		segdb_work_map = map_hddata_2gp_segments(uri_str,
 											 total_segs, segs_participating,

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/resourcemanager/include/utils/memutilities.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/utils/memutilities.h b/src/backend/resourcemanager/include/utils/memutilities.h
index d5f02d6..1f231b3 100644
--- a/src/backend/resourcemanager/include/utils/memutilities.h
+++ b/src/backend/resourcemanager/include/utils/memutilities.h
@@ -115,7 +115,7 @@ void resetSelfMaintainBuffer(SelfMaintainBuffer buffer);
 void resetSelfMaintainBufferCursor(SelfMaintainBuffer buffer, int newcursor);
 
 void appendSelfMaintainBuffer(SelfMaintainBuffer buffer,
-							  char *source,
+							  const char *source,
 							  uint32_t size);
 
 #define appendSMBVar(buffer, val)                                     		   \

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/resourcemanager/include/utils/simplestring.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/utils/simplestring.h b/src/backend/resourcemanager/include/utils/simplestring.h
index 4218d08..2d48780 100644
--- a/src/backend/resourcemanager/include/utils/simplestring.h
+++ b/src/backend/resourcemanager/include/utils/simplestring.h
@@ -45,14 +45,14 @@ void initSimpleStringWithContent( SimpStringPtr str,
 					  	  	  	  int 		    length);
 /* set string value. */
 void setSimpleStringWithContent( SimpStringPtr  str,
-					  	  	 	 char		   *content,
+					  	  	 	 const char		   *content,
 					  	  	 	 int		    length);
 
 /* free simple string with allocated content. */
 void freeSimpleStringContent(SimpStringPtr str);
 
 /* Reference one existing buffer without memory allocation. */
-void setSimpleStringRef(SimpStringPtr str, char *content, int length);
+void setSimpleStringRef(SimpStringPtr str, const char *content, int length);
 
 /* string operations. */
 int  SimpleStringFind(SimpStringPtr str, char *target);
@@ -63,7 +63,7 @@ bool SimpleStringEmpty(SimpStringPtr str);
 int  SimpleStringLocateChar(SimpStringPtr str, char target, int *location);
 /* string to the other number values. */
 int  SimpleStringToInt32(SimpStringPtr str, int32_t *value);
-int  SimpleStringToInt64(SimpStringPtr str, int64_t *value);
+int  SimpleStringToInt64(SimpStringPtr str, int64 *value);
 int  SimpleStringToDouble(SimpStringPtr str, double *value);
 int  SimpleStringToBool(SimpStringPtr str, bool *value);
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/resourcemanager/utils/memutilities.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/utils/memutilities.c b/src/backend/resourcemanager/utils/memutilities.c
index 0e07b8d..3c16c4c 100644
--- a/src/backend/resourcemanager/utils/memutilities.c
+++ b/src/backend/resourcemanager/utils/memutilities.c
@@ -173,7 +173,7 @@ void resetSelfMaintainBufferCursor(SelfMaintainBuffer buffer, int newcursor)
 }
 
 void appendSelfMaintainBuffer(SelfMaintainBuffer buffer,
-							 char *source,
+							 const char *source,
 							 uint32_t size)
 {
 	Assert( buffer != NULL );

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/resourcemanager/utils/simplestring.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/utils/simplestring.c b/src/backend/resourcemanager/utils/simplestring.c
index a03698b..e117680 100644
--- a/src/backend/resourcemanager/utils/simplestring.c
+++ b/src/backend/resourcemanager/utils/simplestring.c
@@ -51,7 +51,7 @@ void initSimpleStringWithContent( SimpStringPtr str,
 }
 
 void setSimpleStringWithContent( SimpStringPtr str,
-					  	  	     char		  *content,
+					  	  	     const char		  *content,
 					  	  	     int		   length)
 {
 	Assert( str != NULL );
@@ -82,10 +82,10 @@ void freeSimpleStringContent(SimpStringPtr  str)
 	str->Len = -1;
 }
 
-void setSimpleStringRef(SimpStringPtr str, char *content, int length)
+void setSimpleStringRef(SimpStringPtr str, const char *content, int length)
 {
 	Assert( str != NULL );
-	str->Str = content;
+	str->Str = (char *)content;
 	str->Len = length;
 	str->Context = NULL;
 }
@@ -269,9 +269,9 @@ int  SimpleStringToUInt32(SimpStringPtr str, uint32_t *value)
 }
 */
 
-int  SimpleStringToInt64(SimpStringPtr str, int64_t *value)
+int  SimpleStringToInt64(SimpStringPtr str, int64 *value)
 {
-	int64_t val;
+	int64 val;
 	int scanres = sscanf(str->Str, INT64_FORMAT, &val);
 	if ( scanres == 1 ) {
 		*value = val;
@@ -372,7 +372,7 @@ int SimpleStringSetOid(SimpStringPtr str, Oid value)
 {
 	static char valuestr[64];
 	Assert(str != NULL);
-	int64_t val = value;
+	int64 val = value;
 	sprintf(valuestr, INT64_FORMAT, val);
 	setSimpleStringNoLen(str, valuestr);
 	return FUNC_RETURN_OK;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/backend/storage/smgr/md.c
----------------------------------------------------------------------
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index b4fd0c3..a532877 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1286,7 +1286,7 @@ mdtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp)
 			 */
 			BlockNumber lastsegblocks = nblocks - priorblocks;
 
-			if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0)
+			if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ))
 				return InvalidBlockNumber;
 			if (!isTemp)
 			{
@@ -1307,7 +1307,7 @@ mdtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp)
 		priorblocks += RELSEG_SIZE;
 	}
 #else
-	if (!MirroredBufferPool_Truncate(&v->mdmir_open, nblocks * BLCKSZ) < 0)
+	if (!MirroredBufferPool_Truncate(&v->mdmir_open, nblocks * BLCKSZ))
 		return InvalidBlockNumber;
 	if (!isTemp)
 	{

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/bin/psql/describe.c
----------------------------------------------------------------------
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 0ef6c6a..1a30fae 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -43,7 +43,7 @@ static void printACLColumn(PQExpBuffer buf, const char *colname);
 static bool isGPDB(void);
 static bool isGPDB4200OrLater(void);
 static bool describePxfTable(const char *profile, const char *pattern, bool verbose);
-static void parsePxfPattern(const char *user_pattern, char **pattern);
+static void parsePxfPattern(char *user_pattern, char **pattern);
 
 /* GPDB 3.2 used PG version 8.2.10, and we've moved the minor number up since then for each
release,  4.1 = 8.2.15 */
 /* Allow for a couple of future releases.  If the version isn't in this range, we are talking
to PostgreSQL, not GPDB */
@@ -4243,7 +4243,7 @@ printACLColumn(PQExpBuffer buf, const char *colname)
  * Splits user_pattern by "." and writes second part to pattern.
  */
 static void
-parsePxfPattern(const char *user_pattern, char **pattern)
+parsePxfPattern(char *user_pattern, char **pattern)
 {
 	strtok(user_pattern, ".");
 	*pattern = strtok(NULL, "/0");
@@ -4346,7 +4346,7 @@ describePxfTable(const char *profile, const char *pattern, bool verbose)
 			/* Initialize */
 			initPQExpBuffer(&title);
 			printfPQExpBuffer(&title, _("PXF %s Table \"%s.%s\""), profile, path, itemname);
-			printTableInit(&cont, &myopt, title.data, cols, total_fields);
+			printTableInit(&cont, (printTableOpt *) &myopt, title.data, cols, total_fields);
 			printTableInitialized = true;
 
 			for (int j = 0; j < cols; j++)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/bin/psql/print.c
----------------------------------------------------------------------
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 6283aed..660f0f1 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -2045,7 +2045,7 @@ ClosePager(FILE *pagerpipe)
  * table.
  */
 void
-printTableInit(printTableContent *const content, const printTableOpt *opt,
+printTableInit(printTableContent *const content, printTableOpt *opt,
 			   const char *title, const int ncolumns, const int nrows)
 {
 	content->opt = opt;
@@ -2380,7 +2380,7 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout,
FILE *f
 	if (cancel_pressed)
 		return;
 
-	printTableInit(&cont, &opt->topt, opt->title,
+	printTableInit(&cont, (printTableOpt *) &opt->topt, opt->title,
 				   PQnfields(result), PQntuples(result));
 
 	for (i = 0; i < cont.ncolumns; i++)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/bin/psql/print.h
----------------------------------------------------------------------
diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h
index 1f54075..d90f1ad 100644
--- a/src/bin/psql/print.h
+++ b/src/bin/psql/print.h
@@ -153,7 +153,7 @@ extern void ClosePager(FILE *pagerpipe);
 extern void html_escaped_print(const char *in, FILE *fout);
 
 extern void printTableInit(printTableContent *const content,
-			   const printTableOpt *opt, const char *title,
+			   printTableOpt *opt, const char *title,
 			   const int ncolumns, const int nrows);
 extern void printTableAddHeader(printTableContent *const content,
 				 const char *header, const bool translate, const char align);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/interfaces/libpq/fe-connect.c
----------------------------------------------------------------------
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 5a4c82f..64c9a95 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -446,7 +446,7 @@ PQconnectStartParams(const char **keywords,
 	{
 		conn->status = CONNECTION_BAD;
 		/* errorMessage is already set */
-		return false;
+		return conn;
 	}
 
 	/*

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bf3e853b/src/interfaces/libpq/fe-exec.c
----------------------------------------------------------------------
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index e17c6b6..f4613b2 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -2386,7 +2386,7 @@ PQresultStatus(const PGresult *res)
 char *
 PQresStatus(ExecStatusType status)
 {
-	if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
+	if (status < PGRES_EMPTY_QUERY || (unsigned int) status >= sizeof pgresStatus / sizeof
pgresStatus[0])
 		return libpq_gettext("invalid ExecStatusType code");
 	return pgresStatus[status];
 }
@@ -2686,7 +2686,7 @@ PQoidStatus(const PGresult *res)
 
 	size_t		len;
 
-	if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
+	if (!res || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
 		return "";
 
 	len = strspn(res->cmdStatus + 7, "0123456789");
@@ -2710,7 +2710,6 @@ PQoidValue(const PGresult *res)
 	unsigned long result;
 
 	if (!res ||
-		!res->cmdStatus ||
 		strncmp(res->cmdStatus, "INSERT ", 7) != 0 ||
 		res->cmdStatus[7] < '0' ||
 		res->cmdStatus[7] > '9')


Mime
View raw message