title: How to check `typeof` for void value at compile time?
body: <p>let's say that I want to have C macro that works on any type.
  I'm using GCC compiler (>= 4.6) and can use GNU99 macros. </p>
  
  <pre><code>//code...
  any_type_t *retVal = function_that_runs_very_long_time(a, b, &amp;&amp;c, **d, &amp;e, *f);
  //other code...
  </code></pre>
  
  <p>usage of macro for TIMER can look for example like this</p>
  
  <pre><code>//code...
  any_type_t *retVal = 
      TIMER(
            function_that_runs_very_long_time(a, b, &amp;&amp;c, **d, &amp;e, *f),
            "TIMING FOR VALUE &lt;%d, %d&gt;", a, b
           );
  //other code...
  </code></pre>
  
  <p>So TIMER has to return value of given function and print duration of its run.
  There is problem with functions that have <code>void</code> return type.</p>
  
  <p>I can obviously have two macros like TIMER_TYPE and TIMER_VOID, but I want to use single one to time function with any return value.</p>
  
  <p>Thank you for suggestions.</p>
  
  <hr>
  
  <p>Edited example of this TIMER macro</p>
  
  <pre><code>#define TIMER(expr, fmt_msg, ...)                           \
  ({                                                          \
      struct timeval before, after;                           \
      uint64_t time_span;                                     \
      int time_span_sec, time_span_usec;                      \
      gettimeofday(&amp;before, NULL);                            \
      typeof(expr) _timer_expr__ = (expr);                    \ // &lt;- static if?
      gettimeofday(&amp;after, NULL);                             \
      time_span = (after.tv_sec * 1000000 + after.tv_usec)    \
                - (before.tv_sec * 1000000 + before.tv_usec); \
      time_span_sec  = time_span / 1000000;                   \
      time_span_usec = time_span % 1000000;                   \
      TRACE(fmt_msg "\n%s : %d.%d seconds",                   \
            #expr, time_span_sec, time_span_usec, ...);       \
      _timer_expr__;                                          \
  })
  </code></pre>