This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS
ClosedPublic

Authored by fanbo-meng on Sep 14 2020, 7:26 AM.

Details

Summary

Aligned allocation is not supported on z/OS. This patch sets -faligned-alloc-unavailable as default in z/OS toolchain.

Diff Detail

Event Timeline

fanbo-meng created this revision.Sep 14 2020, 7:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2020, 7:26 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
fanbo-meng requested review of this revision.Sep 14 2020, 7:26 AM

emit the correct diagnostics for z/OS.

Previous diff is incorrect and didn't include the entire change set, making a new one.

hubert.reinterpretcast added inline comments.
clang/lib/Driver/ToolChains/ZOS.cpp
25–27

Please be consistent in using/not using additional namespace qualification. The declaration above this one takes advantage of the using directive for llvm::opt.

clang/lib/Sema/SemaExprCXX.cpp
1841

Just to ensure we are on the same page:
Passing -Xclang -faligned-alloc-unavailable on the non-Apple platforms does very bad things (hits "unreachable" and otherwise falls off the end of a function without initializing a return value). Part of this patch makes passing -Xclang -faligned-alloc-unavailable okay on z/OS.

fanbo-meng added inline comments.Sep 14 2020, 10:33 AM
clang/lib/Sema/SemaExprCXX.cpp
1841

Yes, as we are trying to solve the same problem like Darwin (lack of support in system libraries), we use the same mechanism that are introduced for that.

fanbo-meng edited the summary of this revision. (Show Details)Sep 14 2020, 10:41 AM
fanbo-meng edited the summary of this revision. (Show Details)

be consistent with namespace qualification

fanbo-meng marked an inline comment as done.

change vendor name from ibm to none for tests.

ahatanak added inline comments.Sep 14 2020, 7:43 PM
clang/include/clang/Basic/DiagnosticSemaKinds.td
7215–7216

Is it possible to merge these two diagnostics?

"aligned %select{allocation|deallocation}0 function of type '%1' is %select{only|not}4 "
"available on %2 %select{%3 or newer|}4"
fanbo-meng added inline comments.Sep 15 2020, 8:33 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
7215–7216

Thanks for reviewing Akira! This merged format does look better, I'll make the change.

merge diagnostics

fanbo-meng set the repository for this revision to rG LLVM Github Monorepo.Sep 15 2020, 8:47 AM
fanbo-meng marked an inline comment as done.Sep 15 2020, 8:49 AM
fanbo-meng marked an inline comment as done.

get platform name from triple instead of hardcoding, and convert its spelling

clang/lib/Basic/Targets/OSTargets.h
773–774

There is an extra semi-colon.

fanbo-meng set the repository for this revision to rG LLVM Github Monorepo.

fix typo

fanbo-meng marked an inline comment as done.Sep 16 2020, 8:56 AM
This revision is now accepted and ready to land.Sep 16 2020, 8:58 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
7216

Can something be done about the trailing space?

clang/test/SemaCXX/unavailable_aligned_allocation.cpp
158

Try to use the regex form to check against trailing whitespace.

fanbo-meng added inline comments.Sep 16 2020, 9:55 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
7216

Thanks for catching that Hubert, I'll fix it.

remove trailing whitespace from diagnostic

fanbo-meng set the repository for this revision to rG LLVM Github Monorepo.Sep 16 2020, 9:56 AM
fanbo-meng marked 2 inline comments as done.