Skip to content

Commit

Permalink
Insert apparently-missing break; in IREquality.cpp (#8211)
Browse files Browse the repository at this point in the history
* Insert apparently-missing `break;` in IREquality.cpp

* Enable -Wimplicit-fallthrough

* Also add -Wimplicit-fallthrough to runtime builds

* Add missing break to runtime/webgpu.cpp

* Also add flag to Makefile

---------

Co-authored-by: Andrew Adams <andrew.b.adams@gmail.com>
  • Loading branch information
steven-johnson and abadams authored Apr 30, 2024
1 parent 8141197 commit dfaf6ad
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function(set_halide_compiler_warnings NAME)
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wcast-qual>
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wignored-qualifiers>
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Woverloaded-virtual>
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wimplicit-fallthrough>

$<$<CXX_COMPILER_ID:GNU>:-Wsuggest-override>

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ WITH_RTTI ?= $(if $(LLVM_HAS_NO_RTTI),, not-empty)
RTTI_CXX_FLAGS=$(if $(WITH_RTTI), , -fno-rtti )

CXX_VERSION = $(shell $(CXX) --version | head -n1)
CXX_WARNING_FLAGS = -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi -Wno-mismatched-new-delete
CXX_WARNING_FLAGS = -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi -Wno-mismatched-new-delete -Wimplicit-fallthrough
ifneq (,$(findstring g++,$(CXX_VERSION)))
GCC_MAJOR_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion | cut -f1 -d.)
GCC_MINOR_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion | cut -f2 -d.)
Expand Down
1 change: 1 addition & 0 deletions src/IREquality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ struct Comparer {
case IRNodeType::GT:
cmp(&GT::a);
cmp(&GT::b);
break;
case IRNodeType::GE:
cmp(&GE::a);
cmp(&GE::b);
Expand Down
1 change: 1 addition & 0 deletions src/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ set(RUNTIME_CXX_FLAGS
-Wno-unused-function
-Wvla
-Wsign-compare
-Wimplicit-fallthrough
)

option(Halide_CLANG_TIDY_BUILD "Generate fake compile jobs for runtime files when running clang-tidy." OFF)
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/webgpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ WEAK int halide_webgpu_run(void *user_context,
switch (arg_type.bits) {
case 1: {
*(int32_t *)arg_out = *((int8_t *)arg_in);
break;
}
case 8: {
*(int32_t *)arg_out = *((int8_t *)arg_in);
Expand All @@ -1048,6 +1049,7 @@ WEAK int halide_webgpu_run(void *user_context,
switch (arg_type.bits) {
case 1: {
*(uint32_t *)arg_out = *((uint8_t *)arg_in);
break;
}
case 8: {
*(uint32_t *)arg_out = *((uint8_t *)arg_in);
Expand Down

0 comments on commit dfaf6ad

Please sign in to comment.