This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/6906] warn about asserts with side effects
- From: "felix.von.s at posteo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Jul 2017 13:29:28 +0000
- Subject: [Bug c/6906] warn about asserts with side effects
- Auto-submitted: auto-generated
- References: <bug-6906-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6906
felix <felix.von.s at posteo dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |felix.von.s at posteo dot de
--- Comment #7 from felix <felix.von.s at posteo dot de> ---
What's wrong with the __builtin_pure_p approach? Sure, the diagnostics
generated by __attribute__((warning)) will be ugly, but it's still something.
It's also very simple to implement: it's just !TREE_SIDE_EFFECTS().
In fact, I patched my copy of GCC to add __builtin_pure_p defined just like
that and it seems to work fine. Might submit it soon (I didn't write any tests,
though).