Inconsistent function definitions in ECPG's informix.c - Mailing list pgsql-hackers

From Tom Lane
Subject Inconsistent function definitions in ECPG's informix.c
Date
Msg-id 2401575.1611764534@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
I noticed that some of the newer compilers in the buildfarm
(e.g., caiman, with gcc 11.0) whine about the definitions of
rjulmdy() and rmdyjul() not quite matching their external
declarations:

informix.c:516:23: warning: argument 2 of type `short int[3]' with mismatched bound [-Warray-parameter=]
  516 | rjulmdy(date d, short mdy[3])
      |                 ~~~~~~^~~~~~
In file included from informix.c:10:
../include/ecpg_informix.h:38:31: note: previously declared as `short int *'
   38 | extern int      rjulmdy(date, short *);
      |                               ^~~~~~~
informix.c:567:15: warning: argument 1 of type `short int[3]' with mismatched bound [-Warray-parameter=]
  567 | rmdyjul(short mdy[3], date * d)
      |         ~~~~~~^~~~~~
In file included from informix.c:10:
../include/ecpg_informix.h:41:25: note: previously declared as `short int *'
   41 | extern int      rmdyjul(short *, date *);
      |                         ^~~~~~~

This isn't a bug really, since per the C spec these declarations
are equivalent.  But it'd be good to silence the warning before
it gets any more common.

The most conservative thing to do would be to take the user-visible
extern declarations as being authoritative, and change informix.c
to match.  I'm slightly tempted to do the opposite though, on the
grounds that showing the expected lengths of the arrays is useful.
But I wonder if anyone's compatibility checker tools would
(mistakenly) classify that as an ABI break.

Thoughts?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Online checksums patch - once again
Next
From: Anastasia Lubennikova
Date:
Subject: Re: pg_upgrade fails with non-standard ACL