Hi,

While compiling on clang, I noticed the following warning:
pg_backup_archiver.c:1950:32: warning: comparison of constant -1 with
expression of type 'ArchiveFormat' (aka 'enum _archiveFormat') is always
false
      [-Wtautological-constant-out-of-range-compare]
                if ((AH->format = fgetc(fh)) == EOF)
                    ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
Something like the patch attached calms down the compiler... This has been
introduced recently by commit cfa1b4a of the 9th of February.
Regards,
-- 
Michael
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 2b36e45..2503348 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -1899,6 +1899,7 @@ _discoverArchiveFormat(ArchiveHandle *AH)
 	if (strncmp(sig, "PGDMP", 5) == 0)
 	{
 		int byteread;
+		int res;
 
 		/*
 		 * Finish reading (most of) a custom-format header.
@@ -1947,8 +1948,9 @@ _discoverArchiveFormat(ArchiveHandle *AH)
 		else
 			AH->offSize = AH->intSize;
 
-		if ((AH->format = fgetc(fh)) == EOF)
+		if ((res = fgetc(fh)) == EOF)
 			exit_horribly(modulename, "could not read input file: %s\n", strerror(errno));
+		AH->format = res;
 		AH->lookahead[AH->lookaheadLen++] = AH->format;
 	}
 	else
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to