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 clang build on MacOS #761

Merged
merged 1 commit into from Sep 25, 2019
Merged

Fix clang build on MacOS #761

merged 1 commit into from Sep 25, 2019

Conversation

tskeith
Copy link
Collaborator

@tskeith tskeith commented Sep 25, 2019

clang doesn't consider std::strlen of a constant to be a constexpr,
so just replace with the actual length.

clang doesn't consider `std::strlen` of a constant to be a constexpr,
so just replace with the actual length.
@@ -43,7 +43,7 @@ using namespace parser::literals;
struct ModHeader {
static constexpr const char *bom{"\xef\xbb\xbf"};
static constexpr const char *magic{"!mod$ v1 sum:"};
static constexpr int magicLen{std::strlen(magic)};
static constexpr int magicLen{13};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even better, declare bom and magic as arrays, use sizeof, and subtract one for the NUL.

@tskeith tskeith merged commit b99d166 into master Sep 25, 2019
@tskeith tskeith deleted the tsk-modfiles branch September 25, 2019 22:58
swift-ci pushed a commit to apple/llvm-project that referenced this pull request Apr 9, 2020
clang doesn't consider `std::strlen` of a constant to be a constexpr,
so just replace with the actual length.

Original-commit: flang-compiler/f18@738deab
Reviewed-on: flang-compiler/f18#761
swift-ci pushed a commit to apple/llvm-project that referenced this pull request Apr 9, 2020
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
clang doesn't consider `std::strlen` of a constant to be a constexpr,
so just replace with the actual length.

Original-commit: flang-compiler/f18@738deab
Reviewed-on: flang-compiler/f18#761
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.

None yet

2 participants