Skip to content

runtime: workaround GCC 4.8 libstdc++ C++11 conformance #17140

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
Jun 12, 2018

Conversation

compnerd
Copy link
Member

libstdc++ included with GCC 4.8 does not define std::max_align_t as
required by the C++11 specification. As a workaround, explicitly create
the definition locally. This was fixed in GCC 4.9 and later.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

@swift-ci please test

@rudkx
Copy link
Contributor

rudkx commented Jun 12, 2018

I expect the Linux testing here (and for any other PR) to fail until swiftlang/swift-corelibs-foundation#1596 is merged.

@compnerd
Copy link
Member Author

Please test with following PR:
swiftlang/swift-corelibs-foundation#1596

@swift-ci please test Linux platform

@@ -44,6 +44,11 @@
#include <cstring>
#include <type_traits>

#if __GLIBCXX__-0 < 20160726
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this be true when not using glibc?

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, crap. I guess I can't do the clever trick. I'll change this to

#if defined(__GLIBCXX__) && __GLIBCXX__ < 20160726

Good catch!

libstdc++ included with GCC 4.8 does not define `std::max_align_t` as
required by the C++11 specification.  As a workaround, explicitly create
the definition locally.  This was fixed in GCC 4.9 and later.
@compnerd
Copy link
Member Author

Please test with following PR:
swiftlang/swift-corelibs-foundation#1596

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 64dcd18fec54a17b7b57b657edba1cd2d9234f49

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 64dcd18fec54a17b7b57b657edba1cd2d9234f49

@compnerd
Copy link
Member Author

@swift-ci please test and merge

1 similar comment
@xedin
Copy link
Contributor

xedin commented Jun 12, 2018

@swift-ci please test and merge

@@ -44,6 +44,11 @@
#include <cstring>
#include <type_traits>

#if defined(__GLIBCXX__) && __GLIBCXX__ < 20160726
#include <stddef.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

…and this could still be cstddef, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

max_align_t is defined by stddef.h, so this is safer. I did have a look at the failure now that I was able to reproduce it, and this definitely fixed it.

@swift-ci swift-ci merged commit 7d26fe0 into swiftlang:master Jun 12, 2018
@compnerd compnerd deleted the aligned branch June 12, 2018 21:39
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.

5 participants