fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Building with -ansi


From: Matt Giuca
Subject: Re: [fluid-dev] Building with -ansi
Date: Mon, 21 Mar 2011 09:10:42 +1100


It doesn't build, though. FluidSynth source code is not ANSI C compliant. MSVC is C90 with a few additional features of C99, but not including the "intermingled declarations and code" syntax. See:  http://en.wikipedia.org/wiki/C99

OK, that makes sense.

Instead of the "-ansi" flag, you may prefer "-pedantic". It reports as warnings all the code not conforming with C90, for instance in this case: "warning: ISO C90 forbids mixed declarations and code". A much more focused GCC  flag to trap this particular mistake is "-Wdeclaration-after-statement", which may be included in the CMakeLists.txt if nobody objects.

It sounds like a good idea, as a declaration-after-statement is going to be rejected by MSVC, we should warn about it in GCC.

The other bug was an implicit void* to char* cast. I searched the GCC man page for any flag that would warn about that but I can't find any specific one. I did find -Wc++-compat, which is documented as: "Warn about ISO C constructs that are outside of the common subset of ISO C and ISO C++, e.g. request for implicit conversion from "void *" to a pointer to non-"void" type." That would detect it, but it might also warn about a whole lot of other things which are irrelevant. Is there a better flag for warning about this?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]