Skip to content

Commit a74bc72

Browse files
cleanup to allow binaryen to be built in more strict environments (WebAssembly#3566)
1 parent 3a368f4 commit a74bc72

22 files changed

Lines changed: 41 additions & 13 deletions

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ else()
233233
add_compile_flag("-Wno-implicit-int-float-conversion")
234234
add_compile_flag("-Wno-unknown-warning-option")
235235
add_compile_flag("-Wswitch") # we explicitly expect this in the code
236+
add_compile_flag("-Wimplicit-fallthrough")
237+
add_compile_flag("-Wnon-virtual-dtor")
238+
236239
if(WIN32)
237240
add_compile_flag("-D_GNU_SOURCE")
238241
add_compile_flag("-D__STDC_FORMAT_MACROS")

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,9 @@ Emscripten's WebAssembly processing library (`wasm-emscripten`).
484484
* Does it compile under Windows and/or Visual Studio?
485485

486486
Yes, it does. Here's a step-by-step [tutorial][win32] on how to compile it
487-
under **Windows 10 x64** with with **CMake** and **Visual Studio 2015**. Help
488-
would be appreciated on Windows and OS X as most of the core devs are on Linux.
487+
under **Windows 10 x64** with with **CMake** and **Visual Studio 2015**.
488+
However, Visual Studio 2017 may now be required. Help would be appreciated on
489+
Windows and OS X as most of the core devs are on Linux.
489490

490491
[compiling to WebAssembly]: https://github.com/WebAssembly/binaryen/wiki/Compiling-to-WebAssembly-with-Binaryen
491492
[win32]: https://github.com/brakmic/bazaar/blob/master/webassembly/COMPILING_WIN32.md

src/dataflow/node.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,12 @@ struct Node {
183183
}
184184
break;
185185
}
186-
case Cond:
186+
case Cond: {
187187
if (index != other.index) {
188188
return false;
189189
}
190+
break;
191+
}
190192
default: {}
191193
}
192194
if (values.size() != other.values.size()) {

src/dataflow/utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#ifndef wasm_dataflow_utils_h
2626
#define wasm_dataflow_utils_h
2727

28+
#include "dataflow/graph.h"
2829
#include "dataflow/node.h"
2930
#include "wasm.h"
3031

src/emscripten-optimizer/istring.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ struct IString {
4848
return (size_t)hash;
4949
}
5050

51-
class CStringHash : public std::hash<const char*> {
51+
class CStringHash {
5252
public:
5353
size_t operator()(const char* str) const { return IString::hash_c(str); }
5454
};
55-
class CStringEqual : public std::equal_to<const char*> {
55+
class CStringEqual {
5656
public:
5757
bool operator()(const char* x, const char* y) const {
5858
return strcmp(x, y) == 0;

src/emscripten-optimizer/optimizer-shared.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ AsmSign detectSign(Ref node, IString minifiedFround) {
205205
if (op == TRSHIFT) {
206206
return ASM_UNSIGNED;
207207
}
208-
} // fallthrough
208+
[[fallthrough]];
209+
}
209210
case '|':
210211
case '&':
211212
case '^':

src/ir/parents.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef wasm_ir_parents_h
1818
#define wasm_ir_parents_h
1919

20+
#include "parsing.h"
21+
2022
namespace wasm {
2123

2224
struct Parents {

src/passes/FuncCastEmulation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ static Expression* fromABI(Expression* value, Type type, Module* module) {
117117
}
118118
case Type::none: {
119119
value = builder.makeDrop(value);
120+
break;
120121
}
121122
case Type::unreachable: {
122123
// can leave it, the call isn't taken anyhow

src/passes/OptimizeInstructions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,7 @@ struct OptimizeInstructions
22042204
Type::v128);
22052205
}
22062206
}
2207+
break;
22072208
}
22082209
default: {
22092210
}

src/passes/Print.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3415,7 +3415,7 @@ printStackIR(StackIR* ir, std::ostream& o, Function* func) {
34153415
}
34163416
case StackInst::TryBegin:
34173417
catchIndexStack.push_back(0);
3418-
// fallthrough
3418+
[[fallthrough]];
34193419
case StackInst::BlockBegin:
34203420
case StackInst::IfBegin:
34213421
case StackInst::LoopBegin: {
@@ -3427,7 +3427,7 @@ printStackIR(StackIR* ir, std::ostream& o, Function* func) {
34273427
}
34283428
case StackInst::TryEnd:
34293429
catchIndexStack.pop_back();
3430-
// fallthrough
3430+
[[fallthrough]];
34313431
case StackInst::BlockEnd:
34323432
case StackInst::IfEnd:
34333433
case StackInst::LoopEnd: {

0 commit comments

Comments
 (0)