postgres.git / summary / log / commit / refs

commit    f7a929a007e64aa9a2c7d65555029ae90c5ed6bd
Author:   Peter Eisentraut <peter@eisentraut.org>
Date:     Tue Oct 22 06:12:43 2024 +0000
First released in: 16.7, 17.3

    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 a67a49648d9, 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
    Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org


src/include/nodes/pathnodes.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index 94aebadd9f9..5e89dbffce2 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -1086,6 +1086,9 @@ typedef struct IndexOptInfo IndexOptInfo; #define HAVE_INDEXOPTINFO_TYPEDEF 1 #endif +struct IndexPath; /* avoid including pathnodes.h here */ +struct PlannerInfo; /* avoid including pathnodes.h here */ + struct IndexOptInfo { pg_node_attr(no_copy_equal, no_read, no_query_jumble) @@ -1185,7 +1188,7 @@ struct IndexOptInfo bool amcanmarkpos; /* AM's cost estimator */ /* Rather than include amapi.h here, we declare amcostestimate like this */ - void (*amcostestimate) () pg_node_attr(read_write_ignore); + void (*amcostestimate) (struct PlannerInfo *, struct IndexPath *, double, Cost *, Cost *, Selectivity *, double *, double *) pg_node_attr(read_write_ignore); }; /* [parent: ae145d1de677]