Inconsistent function definitions in ECPG's informix.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Inconsistent function definitions in ECPG's informix.c
Date: 2021-01-27 16:22:14
Message-ID: 2401575.1611764534@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2021-01-27 16:32:42 Re: pg_upgrade fails with non-standard ACL
Previous Message Heikki Linnakangas 2021-01-27 15:37:52 Re: Online checksums patch - once again