Skip to content

Commit

Permalink
Fixed compilation in GCC 7 (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican authored and kripken committed Dec 1, 2017
1 parent bcc6205 commit e91d1bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,3 @@ IF (UNIX) # TODO: port to windows
INSTALL(TARGETS wasm-reduce DESTINATION ${CMAKE_INSTALL_BINDIR})

ENDIF()

16 changes: 15 additions & 1 deletion src/tools/fuzzing.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ class TranslateToFuzzReader {
hangStack.push_back(nullptr);
condition = makeCondition();
}
// we need to find a proper target to break to; try a few times
// we need to find a proper target to break to; try a few times
int tries = TRIES;
while (tries-- > 0) {
auto* target = vectorPick(breakableStack);
Expand Down Expand Up @@ -1352,12 +1352,26 @@ class TranslateToFuzzReader {
return first;
}

// Trick to avoid a bug in GCC 7.x.
// Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82800
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#if GCC_VERSION > 70000 && GCC_VERSION < 70300
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

template<typename T, typename... Args>
T pickGivenNum(size_t num, T first, Args... args) {
if (num == 0) return first;
return pickGivenNum<T>(num - 1, args...);
}

#if GCC_VERSION > 70000 && GCC_VERSION < 70300
#pragma GCC diagnostic pop
#endif

// utilities

Name getTargetName(Expression* target) {
Expand Down

0 comments on commit e91d1bf

Please sign in to comment.