Add void cast to StaticAssertExpr?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Add void cast to StaticAssertExpr?
Date: 2018-02-15 17:19:46
Message-ID: 16161.1518715186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-02-15 17:23:10 Re: JIT compiling with LLVM v9.1
Previous Message Nikolay Shaplov 2018-02-15 16:29:55 Re: [PATCH][PROPOSAL] Add enum releation option type