+# PGAC_C_TYPEOF
+# -------------
+# Check if the C compiler understands typeof or a variant. Define
+# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
+#
+AC_DEFUN([PGAC_C_TYPEOF],
+[AC_CACHE_CHECK(for typeof, pgac_cv_c_typeof,
+[pgac_cv_c_typeof=no
+for pgac_kw in typeof __typeof__ decltype; do
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+[int x = 0;
+$pgac_kw(x) y;
+y = x;
+return y;])],
+[pgac_cv_c_typeof=$pgac_kw])
+ test "$pgac_cv_c_typeof" != no && break
+done])
+if test "$pgac_cv_c_typeof" != no; then
+ AC_DEFINE(HAVE_TYPEOF, 1,
+ [Define to 1 if your compiler understands `typeof' or something similar.])
+ if test "$pgac_cv_c_typeof" != typeof; then
+ AC_DEFINE(typeof, $pgac_cv_c_typeof, [Define to how the compiler spells `typeof'.])
+ fi
+fi])# PGAC_C_TYPEOF
+
+
+
# PGAC_C_TYPES_COMPATIBLE
# -----------------------
# Check if the C compiler understands __builtin_types_compatible_p,
$as_echo "#define HAVE__STATIC_ASSERT 1" >>confdefs.h
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for typeof" >&5
+$as_echo_n "checking for typeof... " >&6; }
+if ${pgac_cv_c_typeof+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_cv_c_typeof=no
+for pgac_kw in typeof __typeof__ decltype; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+int x = 0;
+$pgac_kw(x) y;
+y = x;
+return y;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ pgac_cv_c_typeof=$pgac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$pgac_cv_c_typeof" != no && break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_typeof" >&5
+$as_echo "$pgac_cv_c_typeof" >&6; }
+if test "$pgac_cv_c_typeof" != no; then
+
+$as_echo "#define HAVE_TYPEOF 1" >>confdefs.h
+
+ if test "$pgac_cv_c_typeof" != typeof; then
+
+$as_echo "#define typeof \$pgac_cv_c_typeof" >>confdefs.h
+
+ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_types_compatible_p" >&5
$as_echo_n "checking for __builtin_types_compatible_p... " >&6; }
PGAC_C_SIGNED
PGAC_C_FUNCNAME_SUPPORT
PGAC_C_STATIC_ASSERT
+PGAC_C_TYPEOF
PGAC_C_TYPES_COMPATIBLE
PGAC_C_BUILTIN_BSWAP32
PGAC_C_BUILTIN_BSWAP64
memcpy(newind->il_info, indexInfo, sizeof(IndexInfo));
/* expressions will likely be null, but may as well copy it */
- newind->il_info->ii_Expressions = (List *)
+ newind->il_info->ii_Expressions =
copyObject(indexInfo->ii_Expressions);
newind->il_info->ii_ExpressionsState = NIL;
/* predicate will likely be null, but may as well copy it */
- newind->il_info->ii_Predicate = (List *)
+ newind->il_info->ii_Predicate =
copyObject(indexInfo->ii_Predicate);
newind->il_info->ii_PredicateState = NULL;
/* no exclusion constraints at bootstrap time, so no need to copy */
* function and is executed repeatedly. (See also the same hack in
* DECLARE CURSOR and PREPARE.) XXX FIXME someday.
*/
- rewritten = pg_analyze_and_rewrite((RawStmt *) copyObject(raw_query),
+ rewritten = pg_analyze_and_rewrite(copyObject(raw_query),
pstate->p_sourcetext, NULL, 0);
/* check that we got back something we can work with */
* and is executed repeatedly. (See also the same hack in EXPLAIN and
* PREPARE.)
*/
- rewritten = QueryRewrite((Query *) copyObject(query));
+ rewritten = QueryRewrite(copyObject(query));
/* SELECT should never rewrite to more or less than one SELECT query */
if (list_length(rewritten) != 1)
OperatorFamilyRelationId, opfamoid);
command->d.opfam.operators = operators;
command->d.opfam.procedures = procedures;
- command->parsetree = copyObject(stmt);
+ command->parsetree = (Node *) copyObject(stmt);
currentEventTriggerState->commandList =
lappend(currentEventTriggerState->commandList, command);
OperatorClassRelationId, opcoid);
command->d.createopc.operators = operators;
command->d.createopc.procedures = procedures;
- command->parsetree = copyObject(stmt);
+ command->parsetree = (Node *) copyObject(stmt);
currentEventTriggerState->commandList =
lappend(currentEventTriggerState->commandList, command);
command->d.atscfg.dictIds = palloc(sizeof(Oid) * ndicts);
memcpy(command->d.atscfg.dictIds, dictIds, sizeof(Oid) * ndicts);
command->d.atscfg.ndicts = ndicts;
- command->parsetree = copyObject(stmt);
+ command->parsetree = (Node *) copyObject(stmt);
currentEventTriggerState->commandList =
lappend(currentEventTriggerState->commandList, command);
command->type = SCT_AlterDefaultPrivileges;
command->d.defprivs.objtype = stmt->action->objtype;
command->in_extension = creating_extension;
- command->parsetree = copyObject(stmt);
+ command->parsetree = (Node *) copyObject(stmt);
currentEventTriggerState->commandList =
lappend(currentEventTriggerState->commandList, command);
* We have to run parse analysis for the expressions. Since the parser is
* not cool about scribbling on its input, copy first.
*/
- params = (List *) copyObject(params);
+ params = copyObject(params);
pstate = make_parsestate(NULL);
pstate->p_sourcetext = queryString;
tlist = CachedPlanGetTargetList(stmt->plansource);
/* Copy into caller's context in case plan gets invalidated */
- return (List *) copyObject(tlist);
+ return copyObject(tlist);
}
/*
* Var node twice. copyObject will expand any multiply-referenced subtree
* into multiple copies.
*/
- viewParse = (Query *) copyObject(viewParse);
+ viewParse = copyObject(viewParse);
/* Create a dummy ParseState for addRangeTableEntryForRelation */
pstate = make_parsestate(NULL);
/* Copy a field that is a pointer to some kind of Node or Node tree */
#define COPY_NODE_FIELD(fldname) \
- (newnode->fldname = copyObject(from->fldname))
+ (newnode->fldname = copyObjectImpl(from->fldname))
/* Copy a field that is a pointer to a Bitmapset */
#define COPY_BITMAPSET_FIELD(fldname) \
*/
#define COPY_NODE_CELL(new, old) \
(new) = (ListCell *) palloc(sizeof(ListCell)); \
- lfirst(new) = copyObject(lfirst(old));
+ lfirst(new) = copyObjectImpl(lfirst(old));
static List *
_copyList(const List *from)
/*
- * copyObject
+ * copyObjectImpl -- implementation of copyObject(); see nodes/nodes.h
*
* Create a copy of a Node tree or list. This is a "deep" copy: all
* substructure is copied too, recursively.
*/
void *
-copyObject(const void *from)
+copyObjectImpl(const void *from)
{
void *retval;