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

Fix build with clang 13 #60328

merged 4 commits into from
Oct 13, 2021

Conversation

am11
Copy link
Member

@am11 am11 commented Oct 13, 2021

Tested with:

$ clang --version | head -1
Ubuntu clang version 13.0.0-++20211006103153+fd1d8c2f04dd-1~exp1~20211006223759.3

Fixes #60326.

Tested with:
```sh
$ clang --version | head -1
Ubuntu clang version 13.0.0-++20211006103153+fd1d8c2f04dd-1~exp1~20211006223759.3
```
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Oct 13, 2021
@ghost
Copy link

ghost commented Oct 13, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Tested with:

$ clang --version | head -1
Ubuntu clang version 13.0.0-++20211006103153+fd1d8c2f04dd-1~exp1~20211006223759.3

Fixes #60326.

Author: am11
Assignees: -
Labels:

area-Infrastructure-libraries, community-contribution

Milestone: -

@am11
Copy link
Member Author

am11 commented Oct 13, 2021

cc @lambdageek, I have tested libs.native+clr+host.native.

`cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type`

But going through an intermediate `void (*) (void)` function type is allowed.
@@ -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.

@akoeplinger akoeplinger merged commit 2265a61 into dotnet:main Oct 13, 2021
@am11 am11 deleted the feature/build/clang-13 branch October 13, 2021 19:37
lambdageek added a commit to lambdageek/runtime that referenced this pull request Oct 15, 2021
* Fix build with clang 13
Tested with:
```sh
$ clang --version | head -1
Ubuntu clang version 13.0.0-++20211006103153+fd1d8c2f04dd-1~exp1~20211006223759.3
```

* Fix gcc build

* Unify supressions

* Fix Clang 13 -Wcast-function-type warning

`cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type`

But going through an intermediate `void (*) (void)` function type is allowed.

Co-authored-by: Aleksey Kliger <[email protected]>
@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libraries] System.Native fails to build with clang-13
6 participants