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:
parent
76d0538b3c
commit
fbc7cd3212
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
5
hyper.h
5
hyper.h
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user