[Bug c/57612] New: add builtin to assert that expression does not have side effects
tromey at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jun 14 16:19:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57612
Bug ID: 57612
Summary: add builtin to assert that expression does not have
side effects
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: tromey at gcc dot gnu.org
It would sometimes be useful to be able to assert
that an expression does not have side effects.
For example, this would be very nice to have for
macros which expand their arguments more than once:
#define multi_expand(x) __builtin_assert_no_side_effects(x) + (x)
Specifically, this builtin would check its argument and
give an error if the argument had an assignment or a call
to a function which is neither "const" nor "pure".
The builtin would evaluate to the value of its argument.
More information about the Gcc-bugs
mailing list