Skip to content

Commit 91e97f2

Browse files
committed
fix: declare loop variable in for loop for clarity
1 parent 38e4171 commit 91e97f2

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

build-scripts/warnings.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,22 @@ else ()
2222
add_compile_options (
2323
$<$<COMPILE_LANGUAGE:C>:-Wimplicit-function-declaration>
2424
)
25+
2526
# https://gcc.gnu.org/gcc-5/changes.html introduces incompatible-pointer-types
26-
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "5.1")
27+
# https://releases.llvm.org/7.0.0/tools/clang/docs/DiagnosticsReference.html#wincompatible-pointer-types
28+
# is the earliest version that supports this option I can found.
29+
# Assume AppClang versioning is compatible with Clang.
30+
if ((CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "5.1")
31+
OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0")
32+
OR (CMAKE_C_COMPILER_ID STREQUAL "AppClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0"))
2733
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wincompatible-pointer-types>)
2834
endif()
35+
2936
# options benefit embedded system.
3037
add_compile_options (
3138
-Wdouble-promotion
3239
)
40+
3341
# waivers
3442
add_compile_options (
3543
-Wno-unused

core/iwasm/interpreter/wasm_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7495,7 +7495,7 @@ wasm_loader_unload(WASMModule *module)
74957495
#endif
74967496
#endif
74977497
#if WASM_ENABLE_BRANCH_HINTS != 0
7498-
for (size_t i = 0; i < module->function_count; i++) {
7498+
for (i = 0; i < module->function_count; i++) {
74997499
// be carefull when adding more hints. This only works as long as
75007500
// the hint structs have been allocated all at once as an array.
75017501
// With only branch-hints at the moment, this is the case.

0 commit comments

Comments
 (0)