title: How to enforce C89-style variable declarations in gcc?
body: <p>I work on a code base which is mostly C with a little C++, and is mostly built with gcc but occasionally it needs to be built with MSVC. Microsoft's C compiler is still pretty much C89 with a few minor extensions, and it still doesn't support mixed code and variable definitions <em>à la</em> C++/C99. So I need to find a way to prevent developers from writing out-of-order code/variable definitions while they are working with gcc, otherwise the build subsequently breaks with MSVC. If I use <code>gcc -std=c89</code> then everything breaks because C++-style comments are not allowed (there may be other issues too, but I haven't looked into this any further). If I use <code>gcc -std=gnu89</code> then the out-of-order code/variable definitions are allowed, so that doesn't help me either. Any ideas ? I guess I just need something like <code>gcc -std=c99 -fno-inline-variable-definitions</code>, if such an option existed.</p>