Skip to content

Fix errors and warnings building swift/reflection on Windows with MSVC #6026

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

Merged
merged 1 commit into from
Dec 12, 2016
Merged

Fix errors and warnings building swift/reflection on Windows with MSVC #6026

merged 1 commit into from
Dec 12, 2016

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Dec 2, 2016

  • Remove improper template qualifiers for non-template methods
  • Fix WIN32 build by including <io.h> instead of POSIX's <unistd.h>
  • Unhandled control path warnings - we can't use llvm_unreachable as this is imported in the stdlib

@@ -452,6 +452,9 @@ class ReflectionContext
case MetadataSourceKind::SelfWitnessTable:
return true;
}

std::cerr << "fatal error: " << "Unhandled MetadataSourceKind in switch." << "\n";
std::abort();
Copy link
Member

Choose a reason for hiding this comment

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

Is this better handled with a covered switch and an unreachable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We get linker errors compiling swiftCore.dll if we use llvm_unreachable. The errors are unresolved external llvm_unreachable_internal. This is because we can't/don't link any LLVM libraries from the stdlib.

Copy link
Member

Choose a reason for hiding this comment

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

See previous comment about introducing a swift_unreachable.

@@ -38,11 +38,11 @@ enum class TypeRefKind {

#define FIND_OR_CREATE_TYPEREF(Allocator, TypeRefTy, ...) \
Copy link
Member

Choose a reason for hiding this comment

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

Please clang-format this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

@@ -772,6 +772,9 @@ class TypeRefVisitor {
::std::forward<Args>(args)...);
#include "swift/Reflection/TypeRefs.def"
}

std::cerr << "fatal error: " << "Unhandled TypeRefKind in switch." << "\n";
std::abort();
Copy link
Member

Choose a reason for hiding this comment

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

Is this better handled with a covered switch and unreachable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@hughbe
Copy link
Contributor Author

hughbe commented Dec 8, 2016

Will update to use swift_unreachable when #6025 is merged

@compnerd
Copy link
Member

@hughbe #6205 is merged

@hughbe
Copy link
Contributor Author

hughbe commented Dec 11, 2016

@compnerd updated, thanks

return Entry->second; \
const auto TR = \
Allocator.DEPENDENT_TEMPLATE makeTypeRef<TypeRefTy>(__VA_ARGS__); \
Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR}); \
Copy link
Member

Choose a reason for hiding this comment

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

We should file a SR to address this difference and try to unify the behavior once the compilers are updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@compnerd
Copy link
Member

@swift-ci please test and merge

@hughbe
Copy link
Contributor Author

hughbe commented Dec 12, 2016

Please retrigger the tests as they didn't get triggered, thanks!

@compnerd
Copy link
Member

@swift-ci please test and merge

@swift-ci swift-ci merged commit 2d5c4de into swiftlang:master Dec 12, 2016
@hughbe hughbe deleted the reflection-msvc branch December 12, 2016 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants