Conversation
ec2f408 to
e57f3d1
Compare
|
Add |
| case Instr::f64_promote_f32: | ||
| { | ||
| stack.top() = double{stack.top().f32}; | ||
| stack.top() = static_cast<double>(stack.top().f32); |
788f2eb to
bece2a1
Compare
Codecov Report
@@ Coverage Diff @@
## master #508 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 56 56
Lines 8704 8704
=======================================
Hits 8594 8594
Misses 110 110 |
| # Enable basing warnings set and treat them as errors. | ||
| add_compile_options(-Werror -Wall -Wextra -Wshadow) | ||
|
|
||
| add_compile_options(-Wdouble-promotion -Wcast-qual -Wcast-align -Wdangling-else -Wlogical-not-parentheses -Wmissing-declarations) |
There was a problem hiding this comment.
I think this must be checked against documentation.
E.g. -Wlogical-not-parentheses
- is enabled in Clang by default: https://clang.llvm.org/docs/DiagnosticsReference.html#wlogical-not-parentheses
- is enabled in GCC with
-Wall: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wall
There was a problem hiding this comment.
I added these based on documentation: first added a lot of the things I liked, then removed those which are included in -Wall (and other settings we have). Seems like this one slipped through the cracks.
There was a problem hiding this comment.
I picked this one randomly.
The -Wdouble-promotion should be remove as I don't want the change #508 (comment).
I will check the rest.
There was a problem hiding this comment.
- It seems
-Wcast-qualand-Wcast-alignis only for C-style casts of pointers. Unlikely we will see such thing in our code, but the warning option can stay. - The
-Wdangling-elseis enabled by default/-Wall. - The
-Wmissing-declarationsis nice.
There was a problem hiding this comment.
The -Wdouble-promotion should be remove as I don't want the change #508 (comment).
Do you have a reasoning? I'd be also interested to hear @gumb0's view.
The double{x} is superior to static_cast<double>(x) and the -Wdouble-promotion forbids using the first syntax. It is rather a compiler bug due to fact that -Wdouble-promotion predates the double{x} syntax.
There is even Clang bug for this: https://bugs.llvm.org/show_bug.cgi?id=34062.
There was a problem hiding this comment.
-Wlogical-not-parentheses looks to be included in -Wall?
There was a problem hiding this comment.
Move the changes to the main CMakeLists.txt, do not modify the Cable file.
0fdc110 to
9b65842
Compare
445273e to
1d5168c
Compare
cddddec to
5228ae2
Compare
fb2f85b to
5a5689e
Compare
5a5689e to
94b61f4
Compare
|
|
||
| option(WEVERYTHING "Enable almost all compiler warnings" OFF) | ||
| if(WEVERYTHING) | ||
| add_compile_options(-Weverything) |
There was a problem hiding this comment.
Why do I not see these on CI?
Build Tidy (Debug) step outputs
----
Generator: Ninja
Compiler: Clang
Build Type: Debug
LTO: OFF
Flags: -Dd_m3HasTracer -Wall -Wextra -Wparentheses -Wundef -Wpointer-arith -Wstrict-aliasing=2 -Werror=implicit-function-declaration -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -Werror=shadow
Debug flags: -g -DDEBUG=1 -ggdb -O0
Release flags: -O3 -Wfatal-errors -fomit-frame-pointer -fno-stack-check -fno-stack-protector
----
are these not all of the flags?
There was a problem hiding this comment.
These are wasm3 flags. We don't add ours to theirs.
There was a problem hiding this comment.
I don't see any warning emitted in Build Tidy, do we not generate any currently? If we did, would CI fail?
There was a problem hiding this comment.
All warnings are fixed.
But here is older build with the warning for #508 (comment): https://app.circleci.com/pipelines/github/wasmx/fizzy/4478/workflows/b12515da-c249-4903-aa9f-8d3d1d5e7cbb/jobs/31809
There was a problem hiding this comment.
I mean, if it fails CI, what's the point of making them optional?
There was a problem hiding this comment.
People can still build it locally without a struggle.
There was a problem hiding this comment.
Do you mean they can build it locally without -Weverything for compilers that we don't test?
There was a problem hiding this comment.
Yes. Clang discourages usage of -Weverything regularly for projects so I want to follow this rule for now. While Fizzy is actively maintained it is probably not big deal, but future versions of Clang may enable something we don't want.
| @@ -0,0 +1,15 @@ | |||
| // Fizzy: A fast WebAssembly interpreter | |||
There was a problem hiding this comment.
Maybe this file should be experimental.hpp, because two of its three functions are defined in experimental.cpp?
Also not sure if the third one - leb128u_decode_u64_noinline - needs to be in its own cpp.
There was a problem hiding this comment.
I would go with something less specific than parser_benchmarks.cpp: experimental.cpp is fine.
This is not explicitly needed now as I discovered [[noinline]] attribute...
There was a problem hiding this comment.
This is resolved now to use experimental.hpp for alternative LEB128 implementation. The other functions were moved to parser_benchmarks.cpp with [[gnu::noinline]] attribute.
| auto it = std::begin(a); | ||
| it = std::transform(std::reverse_iterator{std::end(ps)}, | ||
| std::reverse_iterator{std::begin(ps)}, it, std::negate<T>{}); | ||
| it = std::transform(std::make_reverse_iterator(std::end(ps)), |
There was a problem hiding this comment.
Does this resolve some warning?
There was a problem hiding this comment.
There is warning that reverse_iterator is may not to designed for CTAD (as it does not have any explicit CTAD hints). I think it is ok to change it here as this is the only case for this warning. And I'm also considering rewriting these test arrays to constexpr version where STL algorithms are going to be less useful.
a72268a to
66c480f
Compare
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
No description provided.