allow clean build without using -Wno-missing-field-initializers

This commit is contained in:
nhmall
2023-11-20 14:25:09 -05:00
parent 983000618c
commit 2f167a4672
4 changed files with 44 additions and 8 deletions

View File

@@ -1007,6 +1007,36 @@ typedef struct {
#define UNDEFINED_VALUES { 0 }
#define UNDEFINED_PTR NULL
/* The UNDEFINED_ROLE macro is used to initialize Role variables */
#define UNDEFINED_ROLE \
{ {0}, { {0} }, \
/* strings */ \
NULL, NULL, NULL, \
NULL, NULL, NULL, \
/* indices */ \
0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, \
/* Bitmasks */ \
0, \
/* Attributes */ \
{0}, {0}, {0}, {0}, 0, 0, \
/* spell statistics */ \
0, 0, 0, 0, 0, 0, 0 }
/* The UNDEFINED_RACE macro is used to initialize Race variables */
#define UNDEFINED_RACE \
{ \
/* strings */ \
NULL, NULL, NULL, NULL, {0}, \
/* Indices */ \
0, 0, 0, \
/* Bitmasks */ \
0, 0, 0, 0, \
/* Attributes */ \
{0}, {0}, {0}, {0} \
/* Properties */ \
}
#define MATCH_WARN_OF_MON(mon) \
(Warn_of_mon \
&& ((gc.context.warntype.obj & (mon)->data->mflags2) != 0 \

View File

@@ -308,10 +308,14 @@ const struct instance_globals_d g_init_d = {
0L, /* done_money */
0L, /* domove_attempting */
0L, /* domove_succeeded */
{ { UNDEFINED_VALUES } }, /* dungeons */
{ { {0},{0},{0},{0}, 0, {0}, 0, 0, 0, 0, 0 } }, /* dungeons */
{ 0, 0, 0, 0, 0, 0, 0, 0 }, /* dndest */
FALSE, /* defer_see_monsters */
{ DUMMY }, /* dungeon_topology */
{ {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
0, 0, 0, 0, 0,
{0}, {0}, {0},
{0}, {0}, {0} }, /* dungeon_topology */
0, /* doors_alloc */
NULL, /* doors */
/* dig.c */
@@ -469,7 +473,7 @@ const struct instance_globals_l g_init_l = {
/* dbridge.c */
{ { 0 } }, /* lastseentyp */
{ UNDEFINED_VALUES }, /* level_info */
{ { { UNDEFINED_VALUES } } }, /* level */
{ {0}, {0}, {0}, NULL, NULL, NULL, NULL, NULL, {0} }, /* level */
#if defined(UNIX) || defined(VMS)
0, /* locknum */
#endif
@@ -709,7 +713,7 @@ const struct instance_globals_r g_init_r = {
/* role.c */
UNDEFINED_VALUES, /* role_pa */
UNDEFINED_VALUE, /* role_post_attrib */
{ UNDEFINED_VALUES }, /* rfilter */
{ { 0 }, 0 }, /* rfilter */
/* shk.c */
UNDEFINED_VALUES, /* repo */
TRUE, /* havestate*/
@@ -820,7 +824,7 @@ const struct instance_globals_u g_init_u = {
{ 0, 0, 0, 0, 0, 0, 0, 0 }, /* updest */
FALSE, /* unweapon */
/* role.c */
{ UNDEFINED_VALUES }, /* urole */
UNDEFINED_ROLE, /* urole */
UNDEFINED_VALUES, /* urace */
/* save.c */
{ 0, 0 }, /* uz_save */

View File

@@ -569,7 +569,7 @@ const struct Role roles[NUM_ROLES+1] = {
SPE_MAGIC_MISSILE,
-4 },
/* Array terminator */
{ { 0, 0 } }
UNDEFINED_ROLE,
};
/* Table of all races */
@@ -676,7 +676,7 @@ const struct Race races[] = {
{ 1, 0, 1, 0, 1, 0 } /* Energy */
},
/* Array terminator */
{ 0, 0, 0, 0, { 0, 0 }, NON_PM }
UNDEFINED_RACE,
};
/* Table of all genders */

View File

@@ -45,10 +45,12 @@ endif
#CXX=clang++ -std=gnu++11
CFLAGS=$(CCFLAGS) -I../include -DNOTPARMDECL
CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
CFLAGS+=-Wall -Wextra \
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
CFLAGS+=-pedantic
CFLAGS+=-Wmissing-declarations
#CFLAGS+=-Wno-missing-field-initializers
#CFLAGS+=-Wformat=2
# these are left out of the C++ flags
CFLAGS+=-Wformat-nonliteral