title: Variadic arguments don't work in AIX 5.3 on CC compiler
body: <p>I currently have a bunch of debug macros (hijacked from Zed's book Learn C The Hard Way) and I'm trying to compile them on AIX. The macros:</p>
  
  <pre><code>#ifndef __dbg_h__
  #define __dbg_h__
  
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;string.h&gt;
  
  #ifdef NDEBUG
  #define debug(M, s ...)
  #else
  #define debug(M, s ...) fprintf(stderr, "DEBUG %s:%d: " M "\n", __FILE__, __LINE__, ## s)
  #endif
  
  #define clean_errno() (errno == 0 ? "None" : strerror(errno))
  
  
  #define log_err(M, s ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ## s)
  
  #define log_warn(M, s ...) fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ## s)
  
  #define log_info(M, s ...) fprintf(stderr, "[INFO] (%s:%d) " M "\n", __FILE__, __LINE__, ## s)
  
  #define check(A, M, s ...) if(!(A)) { log_err(M, ## s); errno=0; goto error; }
  
  #define sentinel(M, s ...)  { log_err(M, ## s); errno=0; goto error; }
  
  #define check_mem(A) check((A), "Out of memory.")
  
  #define check_debug(A, M, s ...) if(!(A)) { debug(M, ## s); errno=0; goto error; }
  
  #endif
  </code></pre>
  
  <p>When I compile my project that imports these macros, the AIX CC compiler prints compiler errors with this message, and then exits normally:</p>
  
  <pre><code>"src/dbg.h", line 13.19: 1506-211 (S) Parameter list must be empty, or consist of one or more identifiers separated by commas.
  </code></pre>
  
  <p>It prints one of these to every line in the project that use one of the macro functions.</p>
  
  <p>I've tried setting <code>#pragma langlvl (stdc99)</code> and <code>#pragma langlvl (extc99)</code> as advised in this <a href="http://blog.mellenthin.de/archives/2010/10/26/portable-__va_args__-macros-for-linux-hp-ux-solaris-and-aix/" rel="nofollow">article</a> with no success.</p>
  
  <p>I've also written a small example to see if I can compile it, as follows: </p>
  
  <pre><code>/* file "test.c" */
  #include &lt;stdio.h&gt;
  
  #define PRINTERROR(M, s...) fprintf(stderr, "ERROR MSG: " M "\n", ## s)
  
  int main(void) {
    PRINTERROR("no args");
    PRINTERROR("with args: %s", "foo");
    return 0;
  }
  </code></pre>
  
  <p>The compiler emits the following message:</p>
  
  <pre><code>"test.c", line 4.24: 1506-211 (S) Parameter list must be empty, or consist of one or more identifiers separated by commas.
  </code></pre>
  
  <p>I'm using <code>AIX 5.3</code> and <code>CC for AIX version 6.0.0.0</code>.</p>