Add -Wmissing-field-initializers, fix missing field initializers, and make source

compile even if GCC is not C99 compatible.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3944 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-03-07 18:27:43 +00:00
parent 7b92747cb9
commit 51ca960ed5
4 changed files with 6 additions and 4 deletions

View File

@ -164,7 +164,7 @@ if test "x$enable_debug" = "xyes" ; then
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -Wcheck -Werror"
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DDEBUG"
else
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -Wall -Werror -Wno-unused-label -Wno-pointer-to-int-cast"
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -Wall -Werror -Wno-unused-label -Wno-pointer-to-int-cast -Wmissing-field-initializers"
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DDEBUG"
fi
elif test "x$enable_debug" = "xrelaxed" ; then

View File

@ -23,6 +23,8 @@
// Also PERCENT(int,int); // returns a int value 0->100 of the percentage of the first param over the second
#include "wzglobal.h"
#ifndef __INCLUDED_LIB_FRAMEWORK_MATH_HELP_H__
#define __INCLUDED_LIB_FRAMEWORK_MATH_HELP_H__
@ -36,7 +38,7 @@
# define M_PI 3.14159265358979323846
#endif
#if !defined(WZ_C99) && !(defined(__cplusplus) && defined(WZ_CC_GNU))
#if !defined(WZ_C99) && !(defined(__cplusplus) && defined(WZ_CC_GNU)) && !defined(WZ_CC_GNU)
static inline int roundf(float x)
{
// Ensure that float truncation results in a proper rounding

View File

@ -56,7 +56,7 @@ extern int wz_snprintf(char* str, size_t size, const char* format, ...);
# define snprintf wz_snprintf
#elif defined(__cplusplus) && defined(WZ_CC_GNU)
// Do nothing here, and assume that G++ has a proper implementation of snprintf and vsnprintf
#elif !defined(WZ_C99)
#elif !defined(WZ_CC_GNU)
# error "This code depends on a C99-compliant implementation of snprintf and vsnprintf; please compile as C99 or provide a compliant implementation!"
#endif

View File

@ -393,7 +393,7 @@ BOOL joinCampaign(UDWORD gameNumber, char *sPlayer)
BOOL LobbyLaunched(void)
{
UDWORD i;
PLAYERSTATS pl={0};
PLAYERSTATS pl = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// set the player info as soon as possible to avoid screwy scores appearing elsewhere.
NETplayerInfo();