Skip to content

Commit 2015b06

Browse files
committed
Update comments
1 parent fc75fa2 commit 2015b06

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

llvm/unittests/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ function(add_llvm_target_unittest test_dir_name)
1414
add_llvm_unittest(${test_dir_name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
1515
endfunction()
1616

17-
# GCC may emit false positive warnings against LLVM's style guide.
17+
# gtest macros like EXPECT_TRUE are expanded to a single line
18+
# multi-statement code with if/else. eg:
19+
# if (...)
20+
# EXPECT_TURE(...)
21+
# will be expanded into something like:
22+
# if(...)
23+
# switch (0) case 0: default: if (...) ; else return;;
24+
# GCC may emit false positive dangling-else warnings for such code.
25+
# However, such warnings are actually against LLVM's style guide.
26+
# disable the warning for GCC so that one can enbable Werror.
1827
if (CMAKE_COMPILER_IS_GNUCXX)
1928
list(APPEND LLVM_COMPILE_FLAGS "-Wno-dangling-else")
2029
endif ()

0 commit comments

Comments
 (0)