mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Make backend header files C++ safe
This alters various incidental uses of C++ key words to use other similar identifiers, so that a C++ compiler won't choke outright. You still (probably) need extern "C" { }; around the inclusion of backend headers. based on a patch by Kurt Harriman <harriman@acm.org> Also add a script cpluspluscheck to check for C++ compatibility in the future. As of right now, this passes without error for me.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.432 2009/06/18 01:27:02 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.433 2009/07/16 06:33:42 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1544,7 +1544,7 @@ _copyJoinExpr(JoinExpr *from)
|
||||
COPY_SCALAR_FIELD(isNatural);
|
||||
COPY_NODE_FIELD(larg);
|
||||
COPY_NODE_FIELD(rarg);
|
||||
COPY_NODE_FIELD(using);
|
||||
COPY_NODE_FIELD(usingClause);
|
||||
COPY_NODE_FIELD(quals);
|
||||
COPY_NODE_FIELD(alias);
|
||||
COPY_SCALAR_FIELD(rtindex);
|
||||
@ -1973,7 +1973,7 @@ _copyTypeName(TypeName *from)
|
||||
TypeName *newnode = makeNode(TypeName);
|
||||
|
||||
COPY_NODE_FIELD(names);
|
||||
COPY_SCALAR_FIELD(typeid);
|
||||
COPY_SCALAR_FIELD(typeOid);
|
||||
COPY_SCALAR_FIELD(setof);
|
||||
COPY_SCALAR_FIELD(pct_type);
|
||||
COPY_NODE_FIELD(typmods);
|
||||
@ -2042,7 +2042,7 @@ _copyTypeCast(TypeCast *from)
|
||||
TypeCast *newnode = makeNode(TypeCast);
|
||||
|
||||
COPY_NODE_FIELD(arg);
|
||||
COPY_NODE_FIELD(typename);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
@ -2068,7 +2068,7 @@ _copyColumnDef(ColumnDef *from)
|
||||
ColumnDef *newnode = makeNode(ColumnDef);
|
||||
|
||||
COPY_STRING_FIELD(colname);
|
||||
COPY_NODE_FIELD(typename);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_SCALAR_FIELD(inhcount);
|
||||
COPY_SCALAR_FIELD(is_local);
|
||||
COPY_SCALAR_FIELD(is_not_null);
|
||||
@ -2127,7 +2127,7 @@ _copyXmlSerialize(XmlSerialize *from)
|
||||
|
||||
COPY_SCALAR_FIELD(xmloption);
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_NODE_FIELD(typename);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
@ -2282,7 +2282,7 @@ _copyAlterDomainStmt(AlterDomainStmt *from)
|
||||
AlterDomainStmt *newnode = makeNode(AlterDomainStmt);
|
||||
|
||||
COPY_SCALAR_FIELD(subtype);
|
||||
COPY_NODE_FIELD(typename);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_STRING_FIELD(name);
|
||||
COPY_NODE_FIELD(def);
|
||||
COPY_SCALAR_FIELD(behavior);
|
||||
@ -2712,7 +2712,7 @@ _copyCreateEnumStmt(CreateEnumStmt *from)
|
||||
{
|
||||
CreateEnumStmt *newnode = makeNode(CreateEnumStmt);
|
||||
|
||||
COPY_NODE_FIELD(typename);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_NODE_FIELD(vals);
|
||||
|
||||
return newnode;
|
||||
@ -2747,7 +2747,7 @@ _copyCreateDomainStmt(CreateDomainStmt *from)
|
||||
CreateDomainStmt *newnode = makeNode(CreateDomainStmt);
|
||||
|
||||
COPY_NODE_FIELD(domainname);
|
||||
COPY_NODE_FIELD(typename);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_NODE_FIELD(constraints);
|
||||
|
||||
return newnode;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.355 2009/06/18 01:27:02 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.356 2009/07/16 06:33:42 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -704,7 +704,7 @@ _equalJoinExpr(JoinExpr *a, JoinExpr *b)
|
||||
COMPARE_SCALAR_FIELD(isNatural);
|
||||
COMPARE_NODE_FIELD(larg);
|
||||
COMPARE_NODE_FIELD(rarg);
|
||||
COMPARE_NODE_FIELD(using);
|
||||
COMPARE_NODE_FIELD(usingClause);
|
||||
COMPARE_NODE_FIELD(quals);
|
||||
COMPARE_NODE_FIELD(alias);
|
||||
COMPARE_SCALAR_FIELD(rtindex);
|
||||
@ -966,7 +966,7 @@ static bool
|
||||
_equalAlterDomainStmt(AlterDomainStmt *a, AlterDomainStmt *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(subtype);
|
||||
COMPARE_NODE_FIELD(typename);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_STRING_FIELD(name);
|
||||
COMPARE_NODE_FIELD(def);
|
||||
COMPARE_SCALAR_FIELD(behavior);
|
||||
@ -1330,7 +1330,7 @@ _equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
|
||||
static bool
|
||||
_equalCreateEnumStmt(CreateEnumStmt *a, CreateEnumStmt *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(typename);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_NODE_FIELD(vals);
|
||||
|
||||
return true;
|
||||
@ -1359,7 +1359,7 @@ static bool
|
||||
_equalCreateDomainStmt(CreateDomainStmt *a, CreateDomainStmt *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(domainname);
|
||||
COMPARE_NODE_FIELD(typename);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_NODE_FIELD(constraints);
|
||||
|
||||
return true;
|
||||
@ -1966,7 +1966,7 @@ static bool
|
||||
_equalTypeName(TypeName *a, TypeName *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(names);
|
||||
COMPARE_SCALAR_FIELD(typeid);
|
||||
COMPARE_SCALAR_FIELD(typeOid);
|
||||
COMPARE_SCALAR_FIELD(setof);
|
||||
COMPARE_SCALAR_FIELD(pct_type);
|
||||
COMPARE_NODE_FIELD(typmods);
|
||||
@ -1981,7 +1981,7 @@ static bool
|
||||
_equalTypeCast(TypeCast *a, TypeCast *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_NODE_FIELD(typename);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
@ -2047,7 +2047,7 @@ static bool
|
||||
_equalColumnDef(ColumnDef *a, ColumnDef *b)
|
||||
{
|
||||
COMPARE_STRING_FIELD(colname);
|
||||
COMPARE_NODE_FIELD(typename);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_SCALAR_FIELD(inhcount);
|
||||
COMPARE_SCALAR_FIELD(is_local);
|
||||
COMPARE_SCALAR_FIELD(is_not_null);
|
||||
@ -2207,7 +2207,7 @@ _equalXmlSerialize(XmlSerialize *a, XmlSerialize *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(xmloption);
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_NODE_FIELD(typename);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.64 2009/04/04 21:12:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.65 2009/07/16 06:33:42 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -316,11 +316,11 @@ makeTypeNameFromNameList(List *names)
|
||||
* build a TypeName node to represent a type already known by OID/typmod.
|
||||
*/
|
||||
TypeName *
|
||||
makeTypeNameFromOid(Oid typeid, int32 typmod)
|
||||
makeTypeNameFromOid(Oid typeOid, int32 typmod)
|
||||
{
|
||||
TypeName *n = makeNode(TypeName);
|
||||
|
||||
n->typeid = typeid;
|
||||
n->typeOid = typeOid;
|
||||
n->typemod = typmod;
|
||||
n->location = -1;
|
||||
return n;
|
||||
@ -373,12 +373,12 @@ makeDefElem(char *name, Node *arg)
|
||||
* build a DefElem node with all fields available to be specified
|
||||
*/
|
||||
DefElem *
|
||||
makeDefElemExtended(char *namespace, char *name, Node *arg,
|
||||
makeDefElemExtended(char *nameSpace, char *name, Node *arg,
|
||||
DefElemAction defaction)
|
||||
{
|
||||
DefElem *res = makeNode(DefElem);
|
||||
|
||||
res->defnamespace = namespace;
|
||||
res->defnamespace = nameSpace;
|
||||
res->defname = name;
|
||||
res->arg = arg;
|
||||
res->defaction = defaction;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.40 2009/06/11 14:48:58 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.41 2009/07/16 06:33:42 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -889,7 +889,7 @@ exprLocation(Node *expr)
|
||||
* any of the components might be leftmost.
|
||||
*/
|
||||
loc = exprLocation(tc->arg);
|
||||
loc = leftmostLoc(loc, tc->typename->location);
|
||||
loc = leftmostLoc(loc, tc->typeName->location);
|
||||
loc = leftmostLoc(loc, tc->location);
|
||||
}
|
||||
break;
|
||||
@ -2417,7 +2417,7 @@ bool
|
||||
|
||||
if (walker(tc->arg, context))
|
||||
return true;
|
||||
if (walker(tc->typename, context))
|
||||
if (walker(tc->typeName, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -2468,7 +2468,7 @@ bool
|
||||
{
|
||||
ColumnDef *coldef = (ColumnDef *) node;
|
||||
|
||||
if (walker(coldef->typename, context))
|
||||
if (walker(coldef->typeName, context))
|
||||
return true;
|
||||
if (walker(coldef->raw_default, context))
|
||||
return true;
|
||||
@ -2483,7 +2483,7 @@ bool
|
||||
|
||||
if (walker(xs->expr, context))
|
||||
return true;
|
||||
if (walker(xs->typename, context))
|
||||
if (walker(xs->typeName, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.360 2009/06/11 14:48:58 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.361 2009/07/16 06:33:42 petere Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@ -1259,7 +1259,7 @@ _outJoinExpr(StringInfo str, JoinExpr *node)
|
||||
WRITE_BOOL_FIELD(isNatural);
|
||||
WRITE_NODE_FIELD(larg);
|
||||
WRITE_NODE_FIELD(rarg);
|
||||
WRITE_NODE_FIELD(using);
|
||||
WRITE_NODE_FIELD(usingClause);
|
||||
WRITE_NODE_FIELD(quals);
|
||||
WRITE_NODE_FIELD(alias);
|
||||
WRITE_INT_FIELD(rtindex);
|
||||
@ -1822,7 +1822,7 @@ _outXmlSerialize(StringInfo str, XmlSerialize *node)
|
||||
|
||||
WRITE_ENUM_FIELD(xmloption, XmlOptionType);
|
||||
WRITE_NODE_FIELD(expr);
|
||||
WRITE_NODE_FIELD(typename);
|
||||
WRITE_NODE_FIELD(typeName);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
@ -1832,7 +1832,7 @@ _outColumnDef(StringInfo str, ColumnDef *node)
|
||||
WRITE_NODE_TYPE("COLUMNDEF");
|
||||
|
||||
WRITE_STRING_FIELD(colname);
|
||||
WRITE_NODE_FIELD(typename);
|
||||
WRITE_NODE_FIELD(typeName);
|
||||
WRITE_INT_FIELD(inhcount);
|
||||
WRITE_BOOL_FIELD(is_local);
|
||||
WRITE_BOOL_FIELD(is_not_null);
|
||||
@ -1847,7 +1847,7 @@ _outTypeName(StringInfo str, TypeName *node)
|
||||
WRITE_NODE_TYPE("TYPENAME");
|
||||
|
||||
WRITE_NODE_FIELD(names);
|
||||
WRITE_OID_FIELD(typeid);
|
||||
WRITE_OID_FIELD(typeOid);
|
||||
WRITE_BOOL_FIELD(setof);
|
||||
WRITE_BOOL_FIELD(pct_type);
|
||||
WRITE_NODE_FIELD(typmods);
|
||||
@ -1862,7 +1862,7 @@ _outTypeCast(StringInfo str, TypeCast *node)
|
||||
WRITE_NODE_TYPE("TYPECAST");
|
||||
|
||||
WRITE_NODE_FIELD(arg);
|
||||
WRITE_NODE_FIELD(typename);
|
||||
WRITE_NODE_FIELD(typeName);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.222 2009/06/11 14:48:58 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.223 2009/07/16 06:33:42 petere Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Path and Plan nodes do not have any readfuncs support, because we
|
||||
@ -1070,7 +1070,7 @@ _readJoinExpr(void)
|
||||
READ_BOOL_FIELD(isNatural);
|
||||
READ_NODE_FIELD(larg);
|
||||
READ_NODE_FIELD(rarg);
|
||||
READ_NODE_FIELD(using);
|
||||
READ_NODE_FIELD(usingClause);
|
||||
READ_NODE_FIELD(quals);
|
||||
READ_NODE_FIELD(alias);
|
||||
READ_INT_FIELD(rtindex);
|
||||
|
Reference in New Issue
Block a user