Throw an error when trying to compile with -pg on z/OS,
as the platform does not support gprof.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Basic/DiagnosticDriverKinds.td | ||
---|---|---|
241 ↗ | (On Diff #474406) | Rather than saying "on z/OS" you should say "by the target '%1'" and pass in the triple. There must be the equivalent message already. If not rename the message too (eg. err_option_unsupported_target). |
clang/test/Driver/zos-profiling-error.c | ||
---|---|---|
4 | Prefer --target= for new tests. Consider reusing clang/test/Driver/p.c and adding the code to clang/lib/Driver/ToolChains/Clang.cpp instead |
clang/test/Driver/zos-profiling-error.c | ||
---|---|---|
4 | Sorry, the code is not needed since clang/lib/Driver/ToolChains/Clang.cpp rejects -p for most OSes now. |
See clang/lib/Driver/ToolChains/Clang.cpp:6191 if (TC.SupportsProfiling()) {. You can define SupportsProfiling as false for zos. It's a -Wunused-command-line-argument warning, not an error, but may be good enough.
-p has already been handled, so the subject Throw Error When Using -p or -pg on z/OS should be updated. Note that we don't capitalize every word, just the first word.
Most targets reject -p now. It's unnecessary to have another z/OS specific diagnostic. So this patch can be abandoned.
% fclang -p a.cc clang-16: error: unsupported option '-p' for target 'x86_64-unknown-linux-gnu'
@francii, if you can confirm:
- that there is a test that covers that error for z/OS, and
- any comments in the code associated with generating the error above do not misrepresent the rationale for why -p is unsupported on z/OS,
then I'm good with leaving it at that.
Otherwise, we should make this into an NFC patch that adds the test/adjusts the comments.
- There is no test for z/OS. clang/test/Driver/p.c exists but does not contain a z/OS test case.
- There are no comments explaining why -p is unsupported. Removing support for -p came with D138255, which simply states that -p is only supported on AIX and OpenBSD.
clang/lib/Driver/ToolChains/ZOS.cpp | ||
---|---|---|
22 ↗ | (On Diff #480130) | Sounds reasonable to move -pg diagnostic beside -p. |
I will add the missing e in error: momentarily.