From 41669ab72015765272e688d07a78a04d8b2f5ba7 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 21 Feb 2020 23:26:57 -0500 Subject: [PATCH] Eliminate `-Wmissing-field-initializers` warnings. --- .travis.yml | 2 +- Makefile.simple | 4 +-- classes.cpp | 64 ++++++++++++++++++++------------------- mymake.cpp | 2 +- rogueviz/banachtarski.cpp | 6 ++-- savepng.cpp | 2 +- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1ca9058..b564c558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,7 +137,7 @@ script: # Build hyperrogue. if [[ "$TRAVIS_BUILD_SYSTEM" == "autotools" ]]; then autoreconf -vi - ./configure CXXFLAGS="-Wall -Werror -Wno-unknown-warning-option -Wno-maybe-uninitialized" + ./configure CXXFLAGS="-W -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-unused-parameter -Wno-maybe-uninitialized" make elif [[ "$TRAVIS_BUILD_SYSTEM" == "Makefile" ]]; then make -f Makefile.simple CXX="${HYPERROGUE_CXX-g++}" diff --git a/Makefile.simple b/Makefile.simple index 7c626a61..af7f750f 100644 --- a/Makefile.simple +++ b/Makefile.simple @@ -82,13 +82,13 @@ endif ifeq (${TOOLCHAIN},clang) CXXFLAGS_EARLY += -std=c++11 -march=native CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic - CXXFLAGS_EARLY += -Wno-unknown-warning-option -Wno-format-pedantic -Wno-missing-field-initializers -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized + CXXFLAGS_EARLY += -Wno-unknown-warning-option -Wno-format-pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized endif ifeq (${TOOLCHAIN},gcc) CXXFLAGS_EARLY += -std=c++11 -march=native CXXFLAGS_EARLY += -W -Wall -Wextra -Werror - CXXFLAGS_EARLY += -Wno-unknown-warning-option -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized + CXXFLAGS_EARLY += -Wno-unknown-warning-option -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized endif ifeq (${TOOLCHAIN},mingw) diff --git a/classes.cpp b/classes.cpp index 00f6ab7e..32be1090 100644 --- a/classes.cpp +++ b/classes.cpp @@ -971,43 +971,45 @@ enum eModel : int { // (other bits are used for other information) #define X3(x) x, x, x +#define DEFAULTS 0, 0, 0, 0, 0, nullptr /** list of available models (i.e., projections) */ EX vector mdinf = { - {"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal}, - {"half-plane", "inversion", "half-plane", mf::conformal}, - {"band", "band", "Mercator", mf::band | mf::conformal}, - {X3("polygonal"), mf::conformal}, - {X3("formula"), 0}, - {X3("azimuthal equidistant"), mf::azimuthal | mf::equidistant | mf::euc_boring}, - {X3("azimuthal equi-area"), mf::azimuthal | mf::equiarea | mf::euc_boring}, - {X3("ball model"), mf::conformal | mf::azimuthal | mf::space}, - {"Minkowski hyperboloid", "plane", "sphere", mf::conformal | mf::space | mf::euc_boring}, - {"hemisphere", "sphere", "sphere", mf::conformal | mf::space}, - {X3("band equidistant"), mf::band | mf::equidistant | mf::euc_boring}, - {X3("band equi-area"), mf::band | mf::equiarea | mf::euc_boring}, - {X3("sinusoidal"), mf::pseudoband | mf::equiarea | mf::euc_boring}, - {X3("two-point equidistant"), mf::equidistant | mf::euc_boring | mf::twopoint}, - {X3("fisheye"), 0}, - {X3("Joukowsky transform"), mf::hyper_only | mf::conformal}, - {X3("Joukowsky+inversion"), mf::hyper_only | mf::conformal}, - {X3("rotated hyperboles"), mf::hyper_only}, - {X3("spiral/ring"), mf::hyper_or_torus | mf::uses_bandshift}, - {X3("native perspective"), 0}, - {X3("azimuthal equi-volume"), mf::azimuthal | mf::equivolume | mf::euc_boring}, - {X3("central inversion"), mf::azimuthal | mf::conformal}, - {X3("two-point azimuthal"), mf::euc_boring | mf::twopoint}, - {X3("two-point hybrid"), mf::euc_boring | mf::twopoint}, - {X3("geodesic"), 0}, - {X3("Mollweide"), mf::euc_boring | mf::pseudoband | mf::equiarea }, - {X3("central cylindrical"), mf::euc_boring | mf::band }, - {X3("Collignon"), mf::pseudoband | mf::equiarea }, - {X3("horocyclic coordinates"), mf::euc_boring }, - {X3("guard"), 0}, - {X3("polynomial"), mf::conformal} + {"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal, DEFAULTS}, + {"half-plane", "inversion", "half-plane", mf::conformal, DEFAULTS}, + {"band", "band", "Mercator", mf::band | mf::conformal, DEFAULTS}, + {X3("polygonal"), mf::conformal, DEFAULTS}, + {X3("formula"), 0, DEFAULTS}, + {X3("azimuthal equidistant"), mf::azimuthal | mf::equidistant | mf::euc_boring, DEFAULTS}, + {X3("azimuthal equi-area"), mf::azimuthal | mf::equiarea | mf::euc_boring, DEFAULTS}, + {X3("ball model"), mf::conformal | mf::azimuthal | mf::space, DEFAULTS}, + {"Minkowski hyperboloid", "plane", "sphere", mf::conformal | mf::space | mf::euc_boring, DEFAULTS}, + {"hemisphere", "sphere", "sphere", mf::conformal | mf::space, DEFAULTS}, + {X3("band equidistant"), mf::band | mf::equidistant | mf::euc_boring, DEFAULTS}, + {X3("band equi-area"), mf::band | mf::equiarea | mf::euc_boring, DEFAULTS}, + {X3("sinusoidal"), mf::pseudoband | mf::equiarea | mf::euc_boring, DEFAULTS}, + {X3("two-point equidistant"), mf::equidistant | mf::euc_boring | mf::twopoint, DEFAULTS}, + {X3("fisheye"), 0, DEFAULTS}, + {X3("Joukowsky transform"), mf::hyper_only | mf::conformal, DEFAULTS}, + {X3("Joukowsky+inversion"), mf::hyper_only | mf::conformal, DEFAULTS}, + {X3("rotated hyperboles"), mf::hyper_only, DEFAULTS}, + {X3("spiral/ring"), mf::hyper_or_torus | mf::uses_bandshift, DEFAULTS}, + {X3("native perspective"), 0, DEFAULTS}, + {X3("azimuthal equi-volume"), mf::azimuthal | mf::equivolume | mf::euc_boring, DEFAULTS}, + {X3("central inversion"), mf::azimuthal | mf::conformal, DEFAULTS}, + {X3("two-point azimuthal"), mf::euc_boring | mf::twopoint, DEFAULTS}, + {X3("two-point hybrid"), mf::euc_boring | mf::twopoint, DEFAULTS}, + {X3("geodesic"), 0, DEFAULTS}, + {X3("Mollweide"), mf::euc_boring | mf::pseudoband | mf::equiarea, DEFAULTS}, + {X3("central cylindrical"), mf::euc_boring | mf::band, DEFAULTS}, + {X3("Collignon"), mf::pseudoband | mf::equiarea, DEFAULTS}, + {X3("horocyclic coordinates"), mf::euc_boring, DEFAULTS}, + {X3("guard"), 0, DEFAULTS}, + {X3("polynomial"), mf::conformal, DEFAULTS}, }; #undef X3 +#undef DEFAULTS #if HDR static inline bool orbProtection(eItem it) { return false; } // not implemented diff --git a/mymake.cpp b/mymake.cpp index 1208ca20..35f76421 100644 --- a/mymake.cpp +++ b/mymake.cpp @@ -25,7 +25,7 @@ string preprocessor = "g++ -E"; string compiler = - "g++ -Wall -Wextra -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-implicit-fallthrough -rdynamic -fdiagnostics-color=always -c"; + "g++ -Wall -Wextra -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-implicit-fallthrough -rdynamic -fdiagnostics-color=always -c"; string linker = "g++ -rdynamic -o hyper"; diff --git a/rogueviz/banachtarski.cpp b/rogueviz/banachtarski.cpp index 39fddac5..e399166a 100644 --- a/rogueviz/banachtarski.cpp +++ b/rogueviz/banachtarski.cpp @@ -151,10 +151,8 @@ void recursive_paint(cwpath& pinv, vector& way, int noway) { else gid = 3; - infos[c] = cellinfo{c, gid, 0}; - infos[c].way = way; - infos[c].pinv = pinv; - + infos[c] = cellinfo{c, gid, 0, waNone, itNone, laNone, moNone, way, pinv}; + // c->landparam ^= ((isize(way)&1) * 0x3F3F3F); // c->landparam = hsh; // d * 5 + 256 * (hsh&0xFFFF) + 0x400000; if(cidd>112899) c->landparam = 0x101010; diff --git a/savepng.cpp b/savepng.cpp index bc74ce50..ca05e308 100644 --- a/savepng.cpp +++ b/savepng.cpp @@ -41,7 +41,7 @@ extern "C" SDL_Surface *SDL_PNGFormatAlpha(SDL_Surface *src) { SDL_Surface *surf; - SDL_Rect rect = { 0 }; + SDL_Rect rect = { 0, 0, 0, 0 }; /* NO-OP for images < 32bpp and 32bpp images that already have Alpha channel */ if (src->format->BitsPerPixel <= 24 || src->format->Amask) {