From: Robert Haas Date: Fri, 5 Aug 2011 16:06:29 +0000 (-0400) Subject: Tweak PQresStatus() to avoid a clang compiler warning. X-Git-Tag: REL9_2_BETA1~1329 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b43bf617fdb3ecde709892c3bd8997ac41410f2f;p=postgresql Tweak PQresStatus() to avoid a clang compiler warning. The previous test for status < 0 test is in fact testing nothing if the compiler considers an enum to be an unsigned data type. clang doesn't like tautologies, so do this instead. Report by Peter Geoghegan, fix as suggested by Tom Lane. --- diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 605d242809..113aab086d 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 ((unsigned int) status >= sizeof pgresStatus / sizeof pgresStatus[0]) return libpq_gettext("invalid ExecStatusType code"); return pgresStatus[status]; }