Warning in pg_backup_archiver.c

Started by Michael Paquierabout 12 years ago2 messageshackers
Jump to latest
#1Michael Paquier
michael@paquier.xyz

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

Attachments:

20140221_pg_dump_warning.patchtext/x-patch; charset=US-ASCII; name=20140221_pg_dump_warning.patchDownload+3-1
#2Stephen Frost
sfrost@snowman.net
In reply to: Michael Paquier (#1)
Re: Warning in pg_backup_archiver.c

Michael,

* Michael Paquier (michael.paquier@gmail.com) wrote:

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.

I've got a patch for this already, but it's included in a bunch of other
minor cleanup stuff that I'm still playing with. I hope to commit it
this weekend.

Thanks,

Stephen