Skip to content

Multiple warnings when compiling with new gcc #9

@patricklauer

Description

@patricklauer

With gcc-6.4.0 I'm seeing:

x86_64-pc-linux-gnu-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -pipe -fPIC -fPIC -DSHA_NAME=1 -DSHA_LENGTH=20 -I. -I./ -I/usr/include/postgresql-10/server -I/usr/include/postgresql-10/internal  -D_GNU_SOURCE   -c -o src/sha1.o src/sha1.c
src/crc32.c: In function 'crc32_in':
src/crc32.c:22:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   crc32 *out = palloc(sizeof(crc32));
   ^~~~~
src/crc32.c:27:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   long int pout = strtol(in, &p, 16);
   ^~~~
src/crc32.c:38:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   out = (uint32_t)pout;
       ^
In file included from src/crc32.c:1:0:
src/crc32.c: In function 'crc32_out':
/usr/include/postgresql-10/server/postgres.h:492:27: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
 #define DatumGetUInt32(X) ((uint32) GET_4_BYTES(X))
                           ^
/usr/include/postgresql-10/server/fmgr.h:235:30: note: in expansion of macro 'DatumGetUInt32'
 #define PG_GETARG_UINT32(n)  DatumGetUInt32(PG_GETARG_DATUM(n))
                              ^~~~~~~~~~~~~~
src/crc32.c:6:31: note: in expansion of macro 'PG_GETARG_UINT32'
 #define PG_GETARG_CRC32(N)    PG_GETARG_UINT32(N)
                               ^~~~~~~~~~~~~~~~
src/crc32.c:47:15: note: in expansion of macro 'PG_GETARG_CRC32'
   crc32 *in = PG_GETARG_CRC32(0);
               ^~~~~~~~~~~~~~~
src/crc32.c:49:25: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'crc32 * {aka unsigned int *}' [-Wformat=]
   snprintf(out, 10, "%08x", in);
                         ^
src/md5.c: In function 'md5_recv':
src/md5.c:78:23: warning: pointer targets in passing argument 2 of 'pq_copymsgbytes' differ in signedness [-Wpointer-sign]
  pq_copymsgbytes(buf, result->bytes, nbytes);
                       ^~~~~~
In file included from src/md5.c:15:0:
/usr/include/postgresql-10/server/libpq/pqformat.h:44:13: note: expected 'char *' but argument is of type 'unsigned char *'
 extern void pq_copymsgbytes(StringInfo msg, char *buf, int datalen);
             ^~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions