I think that this has come up already.
One fundamental problem is that you are using a C option with the C++ compiler (CC). If you want to compile C code, use the C compiler (cc).
In my experience, Sun cc is far less lax when it comes to allowing various C++ or C99 features when compiling C89 code (or allowing C89 syntax when compiling C99 code).
Paul