-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Pull over fix from 8e7766b and apply to strstr, sin, an… #66896
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
Conversation
@swift-ci please smoke test |
It's so odd that the linux CI is failing like this :( |
@swift-ci please smoke test |
…ons. Also add back `string.h` as a valid header and ban imports from `_SwiftConcurrencyShims`.
…t`, it's not longer relevant.
@swift-ci please test |
@@ -1,10 +0,0 @@ | |||
// RUN: %target-swift-ide-test -print-module -module-to-print=_SwiftConcurrencyShims -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@egorzhdan can you review this change. Is there some reason we'd want to import this function? It conflicts with Darwin.exit
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it used from swift/stdlib/public/Concurrency/Task.swift
, I wonder if _Concurrency
still builds if we don't import this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think re-declaring exit()
in the shim header isn't really great, it would be nice to just import Darwin.exit
/Glibc.exit
/etc from Task.swift
and use that directly from Swift.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either solution as long as _Concurrency builds with interop enabled 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind taking another look?
|
||
let _ = CxxStdlib.abs(x) // expected-error {{module 'CxxStdlib' has no member named 'abs'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting errors like this:
Darwin.pow:1:13: note: diagnostic produced elsewhere: candidate expects value of type 'Double' for parameter #1 (got 'Float')
public func pow(_: Double, _: Double) -> Double
So I figured we could just test the positive case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also testing the positive case seems more direct in terms of making sure the thing we want to work works. It also is a bit less fragile and more portable.
… conflict with declarations in the `Darwin` module; improve the test.
@swift-ci please smoke test |
@@ -16,6 +16,8 @@ | |||
#ifndef SWIFT_CONCURRENCY_H | |||
#define SWIFT_CONCURRENCY_H | |||
|
|||
#include <stdlib.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DougGregor can you please review this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think I am not going to make this change in this PR. I'm just going to ban the one from stdlib.h
. Otherwise, we will have to update SILGenModule::getExit
to handle a number of modulemaps/platforms.
extern "C" [[noreturn]] | ||
#endif | ||
void exit(int); | ||
|
||
#define EXIT_SUCCESS 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think EXIT_SUCCESS
can also be removed since we now import stdlib.h
where it is defined.
…rom `_SwiftConcurrency.h`.
21e56b2
to
50ce843
Compare
@egorzhdan I decided to actually just ban |
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
5718a4b
to
6233a65
Compare
@swift-ci please smoke test |
let _ = CxxStdlib.div(x) // expected-error {{module 'CxxStdlib' has no member named 'div'}} | ||
let _ = abs(x) | ||
// https://github.com/apple/swift/issues/67006 | ||
// let _ = div(42, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect example of why we should test the positive case: div wasn't available on linux even before this patch because it's in stdlib.h
. Issue filed.
Wouldn't this break existing code that uses |
No. Everyone imports |
…d cos.
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves #NNNNN, fix apple/llvm-project#MMMMM.