Few new warnings have been introduced in windows build (jsonb_util.c)

Started by Amit Kapilaalmost 12 years ago2 messages
#1Amit Kapila
amit.kapila16@gmail.com
1 attachment(s)

Few new warnings have been introduced in windows build.

1>e:\workspace\postgresql\master\postgresql\src\backend\utils\adt\jsonb_util.c(802):
warning C4715: 'JsonbIteratorNext' : not all control paths return a
value
1>e:\workspace\postgresql\master\postgresql\src\backend\utils\adt\jsonb_util.c(1042):
warning C4715: 'JsonbDeepContains' : not all control paths return a
value
1>e:\workspace\postgresql\master\postgresql\src\backend\utils\adt\jsonb_util.c(1175):
warning C4715: 'compareJsonbScalarValue' : not all control paths
return a value

These are quite similar to what we have fixed some time back.
Attached patch fixes these warnings. I am not sure about
fix of warning in 'JsonbIteratorNext', as there is no invalid value
for JSONB processing.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachments:

silence_warning_jsonb-v1.patchapplication/octet-stream; name=silence_warning_jsonb-v1.patchDownload
diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c
index 4a1d445..86e48a3 100644
--- a/src/backend/utils/adt/jsonb_util.c
+++ b/src/backend/utils/adt/jsonb_util.c
@@ -799,6 +799,7 @@ JsonbIteratorNext(JsonbIterator ** it, JsonbValue * val, bool skipNested)
 	}
 
 	elog(ERROR, "invalid iterator state");
+	return -1;
 }
 
 /*
@@ -1039,6 +1040,7 @@ JsonbDeepContains(JsonbIterator ** val, JsonbIterator ** mContained)
 	}
 
 	elog(ERROR, "unexpectedly fell off end of jsonb container");
+	return false;
 }
 
 /*
@@ -1172,6 +1174,7 @@ compareJsonbScalarValue(JsonbValue * aScalar, JsonbValue * bScalar)
 		}
 	}
 	elog(ERROR, "jsonb scalar type mismatch");
+	return -1;
 }
 
 /*
#2Heikki Linnakangas
hlinnakangas@vmware.com
In reply to: Amit Kapila (#1)
Re: Few new warnings have been introduced in windows build (jsonb_util.c)

On 03/27/2014 06:35 AM, Amit Kapila wrote:

Few new warnings have been introduced in windows build.

1>e:\workspace\postgresql\master\postgresql\src\backend\utils\adt\jsonb_util.c(802):
warning C4715: 'JsonbIteratorNext' : not all control paths return a
value
1>e:\workspace\postgresql\master\postgresql\src\backend\utils\adt\jsonb_util.c(1042):
warning C4715: 'JsonbDeepContains' : not all control paths return a
value
1>e:\workspace\postgresql\master\postgresql\src\backend\utils\adt\jsonb_util.c(1175):
warning C4715: 'compareJsonbScalarValue' : not all control paths
return a value

These are quite similar to what we have fixed some time back.
Attached patch fixes these warnings. I am not sure about
fix of warning in 'JsonbIteratorNext', as there is no invalid value
for JSONB processing.

Thanks, applied.

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers