1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-18 04:29:09 +03:00

Remove workarounds against repeat typedefs

This is allowed in C11, so we don't need the workarounds anymore.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org
This commit is contained in:
Peter Eisentraut
2025-09-15 10:53:14 +02:00
parent 0d48d393d4
commit 1e3b5edb8e
2 changed files with 5 additions and 31 deletions

View File

@@ -198,9 +198,6 @@ typedef struct PlannerGlobal
* original Query. Note that at present the planner extensively modifies * original Query. Note that at present the planner extensively modifies
* the passed-in Query data structure; someday that should stop. * the passed-in Query data structure; someday that should stop.
* *
* For reasons explained in optimizer/optimizer.h, we define the typedef
* either here or in that header, whichever is read first.
*
* Not all fields are printed. (In some cases, there is no print support for * Not all fields are printed. (In some cases, there is no print support for
* the field type; in others, doing so would lead to infinite recursion or * the field type; in others, doing so would lead to infinite recursion or
* bloat dump output more than seems useful.) * bloat dump output more than seems useful.)
@@ -211,10 +208,7 @@ typedef struct PlannerGlobal
* correctly replaced with the keeping one. * correctly replaced with the keeping one.
*---------- *----------
*/ */
#ifndef HAVE_PLANNERINFO_TYPEDEF
typedef struct PlannerInfo PlannerInfo; typedef struct PlannerInfo PlannerInfo;
#define HAVE_PLANNERINFO_TYPEDEF 1
#endif
struct PlannerInfo struct PlannerInfo
{ {
@@ -1161,14 +1155,10 @@ typedef struct RelOptInfo
* (by plancat.c), indrestrictinfo and predOK are set later, in * (by plancat.c), indrestrictinfo and predOK are set later, in
* check_index_predicates(). * check_index_predicates().
*/ */
#ifndef HAVE_INDEXOPTINFO_TYPEDEF
typedef struct IndexOptInfo IndexOptInfo;
#define HAVE_INDEXOPTINFO_TYPEDEF 1
#endif
struct IndexPath; /* forward declaration */ struct IndexPath; /* forward declaration */
struct IndexOptInfo typedef struct IndexOptInfo
{ {
pg_node_attr(no_copy_equal, no_read, no_query_jumble) pg_node_attr(no_copy_equal, no_read, no_query_jumble)
@@ -1270,7 +1260,7 @@ struct IndexOptInfo
/* AM's cost estimator */ /* AM's cost estimator */
/* Rather than include amapi.h here, we declare amcostestimate like this */ /* Rather than include amapi.h here, we declare amcostestimate like this */
void (*amcostestimate) (struct PlannerInfo *, struct IndexPath *, double, Cost *, Cost *, Selectivity *, double *, double *) pg_node_attr(read_write_ignore); void (*amcostestimate) (struct PlannerInfo *, struct IndexPath *, double, Cost *, Cost *, Selectivity *, double *, double *) pg_node_attr(read_write_ignore);
}; } IndexOptInfo;
/* /*
* ForeignKeyOptInfo * ForeignKeyOptInfo
@@ -3031,12 +3021,7 @@ typedef struct PlaceHolderVar
* We also create transient SpecialJoinInfos for child joins during * We also create transient SpecialJoinInfos for child joins during
* partitionwise join planning, which are also not present in join_info_list. * partitionwise join planning, which are also not present in join_info_list.
*/ */
#ifndef HAVE_SPECIALJOININFO_TYPEDEF typedef struct SpecialJoinInfo
typedef struct SpecialJoinInfo SpecialJoinInfo;
#define HAVE_SPECIALJOININFO_TYPEDEF 1
#endif
struct SpecialJoinInfo
{ {
pg_node_attr(no_read, no_query_jumble) pg_node_attr(no_read, no_query_jumble)
@@ -3057,7 +3042,7 @@ struct SpecialJoinInfo
bool semi_can_hash; /* true if semi_operators are all hash */ bool semi_can_hash; /* true if semi_operators are all hash */
List *semi_operators; /* OIDs of equality join operators */ List *semi_operators; /* OIDs of equality join operators */
List *semi_rhs_exprs; /* righthand-side expressions of these ops */ List *semi_rhs_exprs; /* righthand-side expressions of these ops */
}; } SpecialJoinInfo;
/* /*
* Transient outer-join clause info. * Transient outer-join clause info.

View File

@@ -28,22 +28,11 @@
* We don't want to include nodes/pathnodes.h here, because non-planner * We don't want to include nodes/pathnodes.h here, because non-planner
* code should generally treat PlannerInfo as an opaque typedef. * code should generally treat PlannerInfo as an opaque typedef.
* But we'd like such code to use that typedef name, so define the * But we'd like such code to use that typedef name, so define the
* typedef either here or in pathnodes.h, whichever is read first. * typedef both here and in pathnodes.h.
*/ */
#ifndef HAVE_PLANNERINFO_TYPEDEF
typedef struct PlannerInfo PlannerInfo; typedef struct PlannerInfo PlannerInfo;
#define HAVE_PLANNERINFO_TYPEDEF 1
#endif
/* Likewise for IndexOptInfo and SpecialJoinInfo. */
#ifndef HAVE_INDEXOPTINFO_TYPEDEF
typedef struct IndexOptInfo IndexOptInfo; typedef struct IndexOptInfo IndexOptInfo;
#define HAVE_INDEXOPTINFO_TYPEDEF 1
#endif
#ifndef HAVE_SPECIALJOININFO_TYPEDEF
typedef struct SpecialJoinInfo SpecialJoinInfo; typedef struct SpecialJoinInfo SpecialJoinInfo;
#define HAVE_SPECIALJOININFO_TYPEDEF 1
#endif
/* It also seems best not to include plannodes.h, params.h, or htup.h here */ /* It also seems best not to include plannodes.h, params.h, or htup.h here */
struct PlannedStmt; struct PlannedStmt;