diff --git a/include/hack.h b/include/hack.h index 270b45fc8..699bc638e 100644 --- a/include/hack.h +++ b/include/hack.h @@ -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 \ diff --git a/src/decl.c b/src/decl.c index 03c6b5559..025939f6b 100644 --- a/src/decl.c +++ b/src/decl.c @@ -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 */ diff --git a/src/role.c b/src/role.c index cbd6ca7c8..852f51174 100644 --- a/src/role.c +++ b/src/role.c @@ -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 */ diff --git a/sys/unix/hints/include/compiler.370 b/sys/unix/hints/include/compiler.370 index ce9896d9b..69a124ef5 100755 --- a/sys/unix/hints/include/compiler.370 +++ b/sys/unix/hints/include/compiler.370 @@ -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