Re: [HACKERS] Compiler warning in costsize.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Compiler warning in costsize.c
Дата
Msg-id 11157.1491583350@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Compiler warning in costsize.c  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: [HACKERS] Compiler warning in costsize.c
Список pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
> Bah. This actually fixes nothing. Attached is a different patch that
> really addresses the problem, by removing the variable because we
> don't want planner_rt_fetch() to run for non-Assert builds.

I don't really like any of these fixes, because they take the code
further away from the structure used by all the other similar functions
in costsize.c, and they will be hard to undo whenever these functions
grow a reason to look at the RTE normally (outside asserts).

I'd be happier with something along the line of
RangeTblEntry *rte;ListCell   *lc;
/* Should only be applied to base relations that are subqueries */Assert(rel->relid > 0);rte =
planner_rt_fetch(rel->relid,root);
 
#ifdef USE_ASSERT_CHECKINGAssert(rte->rtekind == RTE_SUBQUERY);
#else(void) rte;  /* silence unreferenced-variable complaints */
#endif

assuming that that actually does silence the warning on MSVC.

BTW, is it really true that only these two places produce such warnings
on MSVC?  I see about three dozen uses of PG_USED_FOR_ASSERTS_ONLY in our
tree, and I'd have expected all of those places to be causing warnings on
a compiler that doesn't have a way to understand that annotation.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: [HACKERS] Performance issue with postgres9.6
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] ExecPrepareExprList and per-query context