Skip to content

Commit d2b4b4c

Browse files
committed
Fix C23 compiler warning
The approach of declaring a function pointer with an empty argument list and hoping that the compiler will not complain about casting it to another type no longer works with C23, because foo() is now equivalent to foo(void). We don't need to do this here. With a few struct forward declarations we can supply a correct argument list without having to pull in another header file. (This is the only new warning with C23. Together with the previous fix a67a496, this makes the whole code compile cleanly under C23.) Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/95c6a9bf-d306-43d8-b880-664ef08f2944%40eisentraut.org
1 parent 45e0ba3 commit d2b4b4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/include/nodes/pathnodes.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,9 @@ typedef struct IndexOptInfo IndexOptInfo;
11071107
#define HAVE_INDEXOPTINFO_TYPEDEF 1
11081108
#endif
11091109

1110+
struct IndexPath; /* avoid including pathnodes.h here */
1111+
struct PlannerInfo; /* avoid including pathnodes.h here */
1112+
11101113
struct IndexOptInfo
11111114
{
11121115
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
@@ -1206,7 +1209,7 @@ struct IndexOptInfo
12061209
bool amcanmarkpos;
12071210
/* AM's cost estimator */
12081211
/* Rather than include amapi.h here, we declare amcostestimate like this */
1209-
void (*amcostestimate) () pg_node_attr(read_write_ignore);
1212+
void (*amcostestimate) (struct PlannerInfo *, struct IndexPath *, double, Cost *, Cost *, Selectivity *, double *, double *) pg_node_attr(read_write_ignore);
12101213
};
12111214

12121215
/*

0 commit comments

Comments
 (0)