diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -237,6 +237,9 @@ def err_arch_unsupported_isa : Error<"architecture '%0' does not support '%1' execution mode">; +def err_option_unsupported_zos: Error< + "the clang compiler does not support the '%0' option on z/OS.">; + def err_drv_I_dash_not_supported : Error< "'%0' not supported, please use -iquote instead">; def err_drv_unknown_argument : Error<"unknown argument: '%0'">; diff --git a/clang/lib/Driver/ToolChains/ZOS.cpp b/clang/lib/Driver/ToolChains/ZOS.cpp --- a/clang/lib/Driver/ToolChains/ZOS.cpp +++ b/clang/lib/Driver/ToolChains/ZOS.cpp @@ -18,7 +18,12 @@ using namespace clang; ZOS::ZOS(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - : ToolChain(D, Triple, Args) {} + : ToolChain(D, Triple, Args) { + for (Arg *A : Args.filtered(options::OPT_p, options::OPT_pg)) { + auto ArgString = A->getAsString(Args); + this->getDriver().Diag(diag::err_option_unsupported_zos) << ArgString; + } +} ZOS::~ZOS() {} diff --git a/clang/test/Driver/zos-profiling-error.c b/clang/test/Driver/zos-profiling-error.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/zos-profiling-error.c @@ -0,0 +1,7 @@ +// Check failed cases + +// RUN: not %clang -target s390x-none-zos -p -S %s 2>&1 | FileCheck -check-prefix=FAIL-P-NAME %s +// FAIL-P-NAME: error: the clang compiler does not support the '-p' option on z/OS. + +// RUN: not %clang -target s390x-none-zos -pg -S %s 2>&1 | FileCheck -check-prefix=FAIL-PG-NAME %s +// FAIL-PG-NAME: error: the clang compiler does not support the '-pg' option on z/OS.