From b43bf617fdb3ecde709892c3bd8997ac41410f2f Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 5 Aug 2011 12:06:29 -0400 Subject: [PATCH] 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. --- src/interfaces/libpq/fe-exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]; } -- 2.40.0