title: How do I work around the "unknown conversion type character `z' in format" compiler-specific warning?
body: <p>I'm working on code that is cross-compiled to several target architectures.</p>
  
  <p>I looked at the <a href="https://stackoverflow.com/questions/44382862/how-to-printf-a-size-t-without-warning-in-mingw-w64-gcc-7-1">handful</a> <a href="https://stackoverflow.com/questions/21144780/getting-warning-when-using-sizeof/21144798#21144798">of</a> <a href="https://stackoverflow.com/questions/54265217/mingw64-w64-attributeformat-and-cinttypes-header">hits</a> from searching Stack Overflow for "printf size_t unknown conversion type character" warning, however those posts all seem to be related to <code>minGW</code>, so those answers, essentially <code>ifdef</code>ing against <code>_WIN32</code>, do not apply to my instance of essentially the same problem, i.e. <code>printf</code> not recognizing "<code>%zu</code>" as the format-specifier for <code>size_t</code>, but with a <code>mips</code> cross compiler.</p>
  
  <p><strong>Is there an existing compiler flag (for the noted cross-compiler) that enables libc to recognize "%zu" as the format-specifier for <code>size_t</code>?</strong></p>
  
  <pre><code>$ cat ./main.c
  // main.c
  
  #include &lt;stdio.h&gt;
  
  int main( int argc, char* argv[] )
  {
    size_t i = 42;
    printf( "%zu\n", i );
    return 0;
  }
  
  $ /path/to/mips_fp_le-gcc --version
  2.95.3
  $ 
  $ file /path/to/libc.so.6
  /path/to/libc.so.6: ELF 32-bit LSB pie executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 2.2.15, not stripped, too many notes (256)
  $ 
  $ /path/to/mips_fp_le-gcc -mips2 -O2 -EL -DEL -pipe -Wall -Wa,-non_shared -DCPU=SPARC -DLINUX -D_REENTRANT -DPROCESS_AUID -DTAGGING -fPIC -I. -I../../../root/include -I../include -I../../../common/include -I../../..
  /root/include  -DDISABLE_CSL_BITE -DDISABLE_DNS_LOOKUP     -DOS=UNIX -DLINUX -DPOSIX_THREADS -D__USE_GNU -D_FORTIFY_SOURCE=2 -DHANDLE_CSL_DUPLICATES  -DOS=UNIX -DLINUX -DPOSIX_THREADS -D__USE_GNU -D_FORTIFY_SOURCE=2 -DHANDLE_CSL_DUPLICATES  -DOS=UNIX -DLINUX -DPOSIX_THREADS -D__USE_GNU -D_FORTIFY_SOURCE=2 -DHANDLE_C
  SL_DUPLICATES  -DOS=UNIX -DLINUX -DPOSIX_THREADS -D__USE_GNU -D_FORTIFY_SOURCE=2 -DHANDLE_CSL_DUPLICATES -o ./main.o -c main.c 
  main.c: In function `main':
  main.c:6: warning: unknown conversion type character `z' in format
  main.c:6: warning: too many arguments for format
  </code></pre>
  
  <p>If the direct answer to the bolded question is "no", what are other possible solutions? Possibilities that come to mind are...  </p>
  
  <ol>
  <li><code>register_printf_function()</code></li>
  <li>Wrap the format-specifier in a target-specific macro (similar to <a href="https://stackoverflow.com/questions/44382862/how-to-printf-a-size-t-without-warning-in-mingw-w64-gcc-7-1">this <code>minGW</code>-specific post</a>)  </li>
  </ol>
  
  <p>...any other ideas? I'd have a strong preference for solutions not involving target-specific preprocessor code, for which reason the above two are not ideal.</p>
  
  <p>I think (but am not sure) that the cross-compiler version is old; are newer versions <em>of the noted toolchain</em> known/guaranteed to have a <code>libc</code> that recognize "<code>%zu</code>" as the format-specifier to <code>size_t</code>?</p>
  
  <hr>
  
  <p>Update: This cross-compiler seems to not recognize <code>-std=c99</code>; adding it to the compiler flags generates the error "<code>cc1: unknown C standard 'c99'</code>"</p>