Don't warn for declaration-after-statement since we only support GNU99 (#3132)

This change was actually already intended in #3124. However, the
postgres Makefile manually enables this warning too. This way we undo
that.

To confirm that it works two functions were changed to make use of not
having the warning anymore.
pull/3179/head^2
Jelte Fennema 2019-11-15 09:46:06 +01:00 committed by GitHub
parent 495c0f5117
commit 4b9b4b0995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 26 deletions

39
configure vendored
View File

@ -3946,6 +3946,45 @@ if test x"$citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end" =
CITUS_CFLAGS="$CITUS_CFLAGS -Wno-gnu-variable-sized-type-not-at-end" CITUS_CFLAGS="$CITUS_CFLAGS -Wno-gnu-variable-sized-type-not-at-end"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-declaration-after-statement" >&5
$as_echo_n "checking whether $CC supports -Wno-declaration-after-statement... " >&6; }
if ${citusac_cv_prog_cc_cflags__Wno_declaration_after_statement+:} false; then :
$as_echo_n "(cached) " >&6
else
citusac_save_CFLAGS=$CFLAGS
flag=-Wno-declaration-after-statement
case $flag in -Wno*)
flag=-W$(echo $flag | cut -c 6-)
esac
CFLAGS="$citusac_save_CFLAGS $flag"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
citusac_cv_prog_cc_cflags__Wno_declaration_after_statement=yes
else
citusac_cv_prog_cc_cflags__Wno_declaration_after_statement=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$citusac_save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $citusac_cv_prog_cc_cflags__Wno_declaration_after_statement" >&5
$as_echo "$citusac_cv_prog_cc_cflags__Wno_declaration_after_statement" >&6; }
if test x"$citusac_cv_prog_cc_cflags__Wno_declaration_after_statement" = x"yes"; then
CITUS_CFLAGS="$CITUS_CFLAGS -Wno-declaration-after-statement"
fi
# And add a few extra warnings # And add a few extra warnings
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wendif-labels" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wendif-labels" >&5
$as_echo_n "checking whether $CC supports -Wendif-labels... " >&6; } $as_echo_n "checking whether $CC supports -Wendif-labels... " >&6; }

View File

@ -163,6 +163,7 @@ CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-sign-compare])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-missing-field-initializers]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-missing-field-initializers])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-clobbered]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-clobbered])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-gnu-variable-sized-type-not-at-end]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-gnu-variable-sized-type-not-at-end])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-declaration-after-statement])
# And add a few extra warnings # And add a few extra warnings
CITUSAC_PROG_CC_CFLAGS_OPT([-Wendif-labels]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])

View File

@ -17,6 +17,7 @@
#include "commands/extension.h" #include "commands/extension.h"
#include "distributed/citus_ruleutils.h" #include "distributed/citus_ruleutils.h"
#include "distributed/function_utils.h" #include "distributed/function_utils.h"
#include "distributed/listutils.h"
#include "distributed/multi_logical_optimizer.h" #include "distributed/multi_logical_optimizer.h"
#include "distributed/multi_master_planner.h" #include "distributed/multi_master_planner.h"
#include "distributed/multi_physical_planner.h" #include "distributed/multi_physical_planner.h"
@ -141,13 +142,13 @@ MasterTargetList(List *workerTargetList)
static PlannedStmt * static PlannedStmt *
BuildSelectStatement(Query *masterQuery, List *masterTargetList, CustomScan *remoteScan) BuildSelectStatement(Query *masterQuery, List *masterTargetList, CustomScan *remoteScan)
{ {
PlannedStmt *selectStatement = NULL; /* top level select query should have only one range table entry */
Assert(list_length(masterQuery->rtable) == 1);
Agg *aggregationPlan = NULL; Agg *aggregationPlan = NULL;
Plan *topLevelPlan = NULL; Plan *topLevelPlan = NULL;
List *sortClauseList = copyObject(masterQuery->sortClause); List *sortClauseList = copyObject(masterQuery->sortClause);
ListCell *targetEntryCell = NULL; List *columnNameList = NIL;
List *columnNameList = NULL; TargetEntry *targetEntry = NULL;
RangeTblEntry *customScanRangeTableEntry = NULL;
PlannerGlobal *glob = makeNode(PlannerGlobal); PlannerGlobal *glob = makeNode(PlannerGlobal);
PlannerInfo *root = makeNode(PlannerInfo); PlannerInfo *root = makeNode(PlannerInfo);
@ -159,13 +160,11 @@ BuildSelectStatement(Query *masterQuery, List *masterTargetList, CustomScan *rem
/* (1) make PlannedStmt and set basic information */ /* (1) make PlannedStmt and set basic information */
selectStatement = makeNode(PlannedStmt); PlannedStmt *selectStatement = makeNode(PlannedStmt);
selectStatement->canSetTag = true; selectStatement->canSetTag = true;
selectStatement->relationOids = NIL; selectStatement->relationOids = NIL;
selectStatement->commandType = CMD_SELECT; selectStatement->commandType = CMD_SELECT;
/* top level select query should have only one range table entry */
Assert(list_length(masterQuery->rtable) == 1);
remoteScan->custom_scan_tlist = masterTargetList; remoteScan->custom_scan_tlist = masterTargetList;
@ -276,13 +275,12 @@ BuildSelectStatement(Query *masterQuery, List *masterTargetList, CustomScan *rem
/* /*
* (7) Replace rangetable with one with nice names to show in EXPLAIN plans * (7) Replace rangetable with one with nice names to show in EXPLAIN plans
*/ */
foreach(targetEntryCell, masterTargetList) foreach_ptr(targetEntry, masterTargetList)
{ {
TargetEntry *targetEntry = lfirst(targetEntryCell);
columnNameList = lappend(columnNameList, makeString(targetEntry->resname)); columnNameList = lappend(columnNameList, makeString(targetEntry->resname));
} }
customScanRangeTableEntry = linitial(selectStatement->rtable); RangeTblEntry *customScanRangeTableEntry = linitial(selectStatement->rtable);
customScanRangeTableEntry->eref = makeAlias("remote_scan", columnNameList); customScanRangeTableEntry->eref = makeAlias("remote_scan", columnNameList);
return selectStatement; return selectStatement;
@ -371,18 +369,12 @@ FinalizeStatement(PlannerInfo *root, PlannedStmt *result, Plan *top_plan)
static Agg * static Agg *
BuildAggregatePlan(PlannerInfo *root, Query *masterQuery, Plan *subPlan) BuildAggregatePlan(PlannerInfo *root, Query *masterQuery, Plan *subPlan)
{ {
Agg *aggregatePlan = NULL;
AggStrategy aggregateStrategy = AGG_PLAIN;
AggClauseCosts aggregateCosts;
List *aggregateTargetList = NIL;
List *groupColumnList = NIL;
Node *havingQual = NULL;
uint32 groupColumnCount = 0;
/* assert that we need to build an aggregate plan */ /* assert that we need to build an aggregate plan */
Assert(masterQuery->hasAggs || masterQuery->groupClause); Assert(masterQuery->hasAggs || masterQuery->groupClause);
AggClauseCosts aggregateCosts;
aggregateTargetList = masterQuery->targetList; AggStrategy aggregateStrategy = AGG_PLAIN;
List *groupColumnList = masterQuery->groupClause;
List *aggregateTargetList = masterQuery->targetList;
/* /*
* Replaces SubLink nodes with SubPlan nodes in the having section of the * Replaces SubLink nodes with SubPlan nodes in the having section of the
@ -392,7 +384,7 @@ BuildAggregatePlan(PlannerInfo *root, Query *masterQuery, Plan *subPlan)
* these when that is true. However, for some reason hasSubLinks is false * these when that is true. However, for some reason hasSubLinks is false
* even when there are SubLinks. * even when there are SubLinks.
*/ */
havingQual = SS_process_sublinks(root, masterQuery->havingQual, true); Node *havingQual = SS_process_sublinks(root, masterQuery->havingQual, true);
/* /*
* Right now this is not really needed, since we don't support correlated * Right now this is not really needed, since we don't support correlated
@ -409,11 +401,9 @@ BuildAggregatePlan(PlannerInfo *root, Query *masterQuery, Plan *subPlan)
get_agg_clause_costs(root, (Node *) havingQual, AGGSPLIT_SIMPLE, &aggregateCosts); get_agg_clause_costs(root, (Node *) havingQual, AGGSPLIT_SIMPLE, &aggregateCosts);
groupColumnList = masterQuery->groupClause;
groupColumnCount = list_length(groupColumnList);
/* if we have grouping, then initialize appropriate information */ /* if we have grouping, then initialize appropriate information */
if (groupColumnCount > 0) if (list_length(groupColumnList) > 0)
{ {
bool groupingIsHashable = grouping_is_hashable(groupColumnList); bool groupingIsHashable = grouping_is_hashable(groupColumnList);
bool groupingIsSortable = grouping_is_sortable(groupColumnList); bool groupingIsSortable = grouping_is_sortable(groupColumnList);
@ -460,8 +450,8 @@ BuildAggregatePlan(PlannerInfo *root, Query *masterQuery, Plan *subPlan)
} }
/* finally create the plan */ /* finally create the plan */
aggregatePlan = makeAggNode(groupColumnList, (List *) havingQual, Agg *aggregatePlan = makeAggNode(groupColumnList, (List *) havingQual,
aggregateStrategy, aggregateTargetList, subPlan); aggregateStrategy, aggregateTargetList, subPlan);
/* just for reproducible costs between different PostgreSQL versions */ /* just for reproducible costs between different PostgreSQL versions */
aggregatePlan->plan.startup_cost = 0; aggregatePlan->plan.startup_cost = 0;