Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with clang 13 #60328

Merged
merged 4 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ if (CLR_CMAKE_HOST_UNIX)
#These seem to indicate real issues
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)

add_compile_options(-Wno-unused-but-set-variable)

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-unknown-warning-option)

Expand All @@ -376,8 +378,6 @@ if (CLR_CMAKE_HOST_UNIX)

# Disabled warnings
add_compile_options(-Wno-unused-private-field)
# Explicit constructor calls are not supported by clang (this->ClassName::ClassName())
add_compile_options(-Wno-microsoft)
am11 marked this conversation as resolved.
Show resolved Hide resolved
# There are constants of type BOOL used in a condition. But BOOL is defined as int
# and so the compiler thinks that there is a mistake.
add_compile_options(-Wno-constant-logical-operand)
Expand All @@ -390,8 +390,10 @@ if (CLR_CMAKE_HOST_UNIX)
# to a struct or a class that has virtual members or a base class. In that case, clang
# may not generate the same object layout as MSVC.
add_compile_options(-Wno-incompatible-ms-struct)

add_compile_options(-Wno-reserved-identifier)
add_compile_options(-Wno-cast-function-type)
else()
add_compile_options(-Wno-unused-but-set-variable)
add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)
add_compile_options(-Wno-array-bounds)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10912,7 +10912,7 @@ GenTree* Compiler::fgMorphCastedBitwiseOp(GenTreeOp* tree)
// tree op1
// / \ |
// op1 op2 ==> tree
// | | / \
// | | / \.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintentional change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this is to tell the compiler that the backslash at the end of the line is ok: #56281 (comment)

Copy link
Member Author

@am11 am11 Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes the gcc build failure which was introduced by 68042e1 (failing on other PRs atm). basically gcc doesn't like single-line comment ending with \ so we put period at the end or convert it to a block comment /**/ instead of //
search \. in morph.cpp to see other places where we fix the same thing in the past.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw your second comment.
(everything on PR page is loaded asynchronously except for the review comment 🤷)

Copy link
Member

@akoeplinger akoeplinger Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged #60333 which fixes this as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, couple of years back 5bac01a#diff-4fc9b329f498a5462a489299cbdb038dfcb00c1fe30864ccb950e80461238fbb fixed this error by either using multi-line comments:

// good.cpp

/*
    tree
        \
         X
*/

or putting a period after trailing backslash if someone prefers single line comments:

// also-good.cpp

//    tree
//        \.
//         X

nesting single-line comments in multi-line ones wasn't necessary and can be deleted.

// x y x y
//
// (op2 becomes garbage)
Expand Down