Inconsistent function definitions in ECPG's informix.c
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Michael Meskes <meskes@postgresql.org>
Date: 2021-01-27T16:22:14Z
Lists: 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
Commits
-
Make ecpg's rjulmdy() and rmdyjul() agree with their declarations.
- 27c79a46aae3 9.5.25 landed
- edb39e321049 9.6.21 landed
- 46371600aa2d 10.16 landed
- ee62fcaf3894 11.11 landed
- 25f9a7266282 12.6 landed
- 1449770d31fd 13.2 landed
- 1b242f42ba1e 14.0 landed