diff --git a/.travis.yml b/.travis.yml index 60b56e27..c3159872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -123,7 +123,7 @@ script: # Build hyperrogue. if [[ "$TRAVIS_BUILD_SYSTEM" == "autotools" ]]; then autoreconf -vi - ./configure CXXFLAGS="-Wall -Werror -Wno-error=unused-result" + ./configure CXXFLAGS="-Wall -Werror" make elif [[ "$TRAVIS_BUILD_SYSTEM" == "Makefile" ]]; then make -f Makefile.simple diff --git a/Makefile.simple b/Makefile.simple index d739aa93..0e5466ce 100644 --- a/Makefile.simple +++ b/Makefile.simple @@ -88,7 +88,7 @@ endif ifeq (${TOOLCHAIN},gcc) CXXFLAGS_EARLY += -std=c++11 -march=native CXXFLAGS_EARLY += -W -Wall -Wextra -Werror - CXXFLAGS_EARLY += -Wno-empty-body -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result + CXXFLAGS_EARLY += -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter endif ifeq (${TOOLCHAIN},mingw) diff --git a/config.cpp b/config.cpp index 115c0b38..d7ece9fd 100644 --- a/config.cpp +++ b/config.cpp @@ -106,10 +106,8 @@ void loadcs(FILE *f, charstyle& cs, int xvernum) { if(err) cs.charid = gflags & 15; if(err) vid.samegender = (gflags & 16) ? true : false; - if(cs.charid == 3) if(fscanf(f, "%x", &cs.dresscolor2)) - ; - if(xvernum >= 8990) if(fscanf(f, "%x", &cs.uicolor)) - ; + if(cs.charid == 3) hr::ignore(fscanf(f, "%x", &cs.dresscolor2)); + if(xvernum >= 8990) hr::ignore(fscanf(f, "%x", &cs.uicolor)); } #endif @@ -402,8 +400,7 @@ void saveConfig() { void readf(FILE *f, ld& x) { double fl = x; - if(fscanf(f, "%lf", &fl)) - ; + hr::ignore(fscanf(f, "%lf", &fl)); x = fl; } diff --git a/hyper.h b/hyper.h index ace9945b..bcb9372d 100644 --- a/hyper.h +++ b/hyper.h @@ -10,6 +10,11 @@ namespace hr { +template +void ignore(T&&) { + // placate GCC's overzealous -Wunused-result + } + // functions and types used from the standard library using std::vector; using std::map; diff --git a/mapeditor.cpp b/mapeditor.cpp index 5ed59c8e..61dc72c0 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -1320,7 +1320,7 @@ namespace mapeditor { if(vernum >= 0xA0A0) { int tg, wp; int nt; - fscanf(f, "%d%d%d%d\n", &tg, &nt, &wp, &patterns::subpattern_flags); + hr::ignore(fscanf(f, "%d%d%d%d\n", &tg, &nt, &wp, &patterns::subpattern_flags)); patterns::whichPattern = wp; if(tg != geometry) { targetgeometry = eGeometry(tg); stop_game_and_switch_mode(rg::geometry); } if(bool(nt) != nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); diff --git a/rogueviz-kohonen.cpp b/rogueviz-kohonen.cpp index 01b24238..80dfa1ef 100644 --- a/rogueviz-kohonen.cpp +++ b/rogueviz-kohonen.cpp @@ -976,7 +976,7 @@ template void load_raw(string fname, vector& v) { auto s = ftell(f); rewind(f); v.resize(s / sizeof(v[0])); - fread(&v[0], sizeof(v[0]), v.size(), f); + hr::ignore(fread(&v[0], sizeof(v[0]), v.size(), f)); fclose(f); }