Re: Add void cast to StaticAssertExpr?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Add void cast to StaticAssertExpr?
Дата
Msg-id 20180215180452.xsb5lx5h32fjt4ed@alap3.anarazel.de
обсуждение исходный текст
Ответ на Add void cast to StaticAssertExpr?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2018-02-15 12:19:46 -0500, Tom Lane wrote:
> While poking around in buildfarm results, I noticed that some members are
> giving warnings like
> 
> analyze.c:386:181: warning: expression result unused [-Wunused-value]
> 
> which is apparently caused by the use of StaticAssertExpr in
> 
> #define AllocSetContextCreate(parent, name, allocparams) \
>     (StaticAssertExpr(__builtin_constant_p(name), \
>                       "Use AllocSetContextCreateExtended with MEMCONTEXT_COPY_NAME for non-constant context names"),
\
>      AllocSetContextCreateExtended(parent, name, 0, allocparams))
> 
> Now, I could silence those warnings via
> 
> -    (StaticAssertExpr(__builtin_constant_p(name), \
> +    ((void) StaticAssertExpr(__builtin_constant_p(name), \
> 
> as I see has already been done in two similar uses of StaticAssertExpr in
> c.h.  However, this seems a bit silly.  Wouldn't it be better to put
> the void cast right into StaticAssertExpr?

No argument against it here.

Greetings,

Andres Freund


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: spin.c includes pg_sema.h even if unnecessary
Следующее
От: Andres Freund
Дата:
Сообщение: Re: JIT compiling with LLVM v10.1