Inconsistent function definitions in ECPG's informix.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Inconsistent function definitions in ECPG's informix.c
Дата
Msg-id 2401575.1611764534@sss.pgh.pa.us
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Online checksums patch - once again
Следующее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: pg_upgrade fails with non-standard ACL