title: Catching assert() with side effects
body: <p>We have several moderately sized C code bases that receive commits from developers with a variety of experience levels. Some of the less disciplined programmers commit <code>assert()</code> statements with side effects that cause bugs with assertions disabled. E.g.</p>
  
  <pre><code>assert(function_that_should_always_be_called());
  </code></pre>
  
  <p>We already use our own <code>assert()</code> implementation, but evaluating the expression with <code>NDEBUG</code> defined would cause unacceptable performance degradations. Is there a GCC extension or flag we can pass that will trigger compile time warnings/errors for these? With simple enough control flow it should be possible for GCC to determine that you are only calling pure functions.</p>