forward declaration in c - Mailing list pgsql-hackers

From Pavel Stehule
Subject forward declaration in c
Date
Msg-id 162867790905250420r5c96963ofdded4351f91a062@mail.gmail.com
Whole thread Raw
Responses Re: forward declaration in c  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Hello

I can't to find fine syntax for cyclic declaration:

.
typedef Node *(*TransformColumnRef_hook_type) (ParseState *pstate,
ColumnRef *cref);

typedef struct ParseState
{       struct ParseState *parentParseState;            /* stack link */       const char *p_sourcetext;       /*
sourcetext, or NULL if not 
available */       List       *p_rtable;           /* range table so far */       List       *p_joinexprs;        /*
JoinExprsfor RTE_JOIN 
p_rtable entries */       List       *p_joinlist;         /* join items so far (will
become FromExpr                                                                *
node's fromlist) */       List       *p_relnamespace; /* current namespace for relations */       List
*p_varnamespace;/* current namespace for columns */       List       *p_ctenamespace; /* current namespace for common 
table exprs */       List       *p_future_ctes;      /* common table exprs not yet
in namespace */       List       *p_windowdefs;       /* raw representations of
window clauses */       Oid                *p_paramtypes;       /* OIDs of types for
$n parameter symbols */       int                     p_numparams;    /* allocated size of
p_paramtypes[] */       int                     p_next_resno;   /* next targetlist
resno to assign */       List       *p_locking_clause;           /* raw FOR UPDATE/FOR
SHARE info */       Node       *p_value_substitute;         /* what to replace
VALUE with, if any */       bool            p_variableparams;       bool            p_hasAggs;       bool
p_hasWindowFuncs;      bool            p_hasSubLinks;       bool            p_is_insert;       bool
p_is_update;      Relation        p_target_relation;       RangeTblEntry *p_target_rangetblentry;
TransformColumnRef_hook_type   transformColumnRef_hook; 
} ParseState;

with empty declaration typedef struct ParseState;

I got errors:
In file included from ../../../src/include/catalog/heap.h:18,                from parse_clause.c:20:
../../../src/include/parser/parse_node.h:79: warning: useless storage
class specifier in empty declaration
../../../src/include/parser/parse_node.h:81: error: expected ‘)’
before ‘*’ token
../../../src/include/parser/parse_node.h:109: error: expected
specifier-qualifier-list before ‘TransformColumnRef_hook_type’

thank you
Pavel


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: generic options for explain
Next
From: Martijn van Oosterhout
Date:
Subject: Re: forward declaration in c