1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

Fix -Wempty-body warnings on GCC.

This commit is contained in:
Arthur O'Dwyer 2018-07-13 23:45:14 -07:00
parent 76d0538b3c
commit fbc7cd3212
6 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;
}

View File

@ -10,6 +10,11 @@
namespace hr {
template<class T>
void ignore(T&&) {
// placate GCC's overzealous -Wunused-result
}
// functions and types used from the standard library
using std::vector;
using std::map;

View File

@ -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);

View File

@ -976,7 +976,7 @@ template<class T> void load_raw(string fname, vector<T>& 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);
}