Thread: implicit declaration of datumIsEqual in parse_coerce.c

implicit declaration of datumIsEqual in parse_coerce.c

From
Tomas Vondra
Date:
Hi,

Not sure what changed, but I'm seeing this failure:

parse_coerce.c: In function ‘coerce_type’:
parse_coerce.c:345:9: warning: implicit declaration of function ‘datumIsEqual’ [-Wimplicit-function-declaration]
   345 |    if (!datumIsEqual(newcon->constvalue, val2, false, newcon->constlen))
       |         ^~~~~~~~~~~~

Not sure if this because of compiler version (I'm on gcc 9.2.1) or
something else - I don't see any obvious changes to relevant parts of
the code, but I haven't dug too much.

Simply including 'utils/datum.h' resolves the issue.


regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: implicit declaration of datumIsEqual in parse_coerce.c

From
Tom Lane
Date:
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> Not sure what changed, but I'm seeing this failure:

> parse_coerce.c: In function ‘coerce_type’:
> parse_coerce.c:345:9: warning: implicit declaration of function ‘datumIsEqual’ [-Wimplicit-function-declaration]
>    345 |    if (!datumIsEqual(newcon->constvalue, val2, false, newcon->constlen))
>        |         ^~~~~~~~~~~~

That's inside "#ifdef RANDOMIZE_ALLOCATED_MEMORY", which probably
explains why most of us aren't seeing it.  My guess is somebody
removed an #include without realizing that this chunk of code
needed it.

            regards, tom lane



Re: implicit declaration of datumIsEqual in parse_coerce.c

From
Michael Paquier
Date:
On Tue, Apr 07, 2020 at 05:16:58PM -0400, Tom Lane wrote:
> That's inside "#ifdef RANDOMIZE_ALLOCATED_MEMORY", which probably
> explains why most of us aren't seeing it.  My guess is somebody
> removed an #include without realizing that this chunk of code
> needed it.

[cough]

commit: 4dbcb3f844eca4a401ce06aa2781bd9a9be433e9
author: Tom Lane <tgl@sss.pgh.pa.us>
date: Sat, 14 Mar 2020 14:42:22 -0400
Restructure polymorphic-type resolution in funcapi.c.
[...]
@@ -26,7 +25,6 @@
 #include "parser/parse_relation.h"
 #include "parser/parse_type.h"
 #include "utils/builtins.h"
-#include "utils/datum.h"
 #include "utils/lsyscache.h"
--
Michael

Attachment

Re: implicit declaration of datumIsEqual in parse_coerce.c

From
Tom Lane
Date:
Michael Paquier <michael@paquier.xyz> writes:
> On Tue, Apr 07, 2020 at 05:16:58PM -0400, Tom Lane wrote:
>> That's inside "#ifdef RANDOMIZE_ALLOCATED_MEMORY", which probably
>> explains why most of us aren't seeing it.  My guess is somebody
>> removed an #include without realizing that this chunk of code
>> needed it.

> [cough]

Bleagh.  Either of you want to put it back?  (Maybe with a comment
this time, like "needed for datumIsEqual()".)

Curiously, there are no buildfarm warnings about this, even though we have
at least one member running with RANDOMIZE_ALLOCATED_MEMORY.  Wonder why?

            regards, tom lane



Re: implicit declaration of datumIsEqual in parse_coerce.c

From
Noah Misch
Date:
On Tue, Apr 07, 2020 at 10:39:30PM -0400, Tom Lane wrote:
> > On Tue, Apr 07, 2020 at 05:16:58PM -0400, Tom Lane wrote:
> >> That's inside "#ifdef RANDOMIZE_ALLOCATED_MEMORY", which probably
> >> explains why most of us aren't seeing it.  My guess is somebody
> >> removed an #include without realizing that this chunk of code
> >> needed it.

> Curiously, there are no buildfarm warnings about this, even though we have
> at least one member running with RANDOMIZE_ALLOCATED_MEMORY.  Wonder why?

The RANDOMIZE_ALLOCATED_MEMORY buildfarm members use xlc, which disables this
warning by default.  (Given flag -qinfo=pro, it would warn.)