Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -70,6 +70,7 @@ #include "llvm/Option/Option.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ExitCodes.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Host.h" @@ -86,7 +87,6 @@ #include #if LLVM_ON_UNIX #include // getpid -#include // EX_IOERR #endif using namespace clang::driver; Index: llvm/cmake/config-ix.cmake =================================================================== --- llvm/cmake/config-ix.cmake +++ llvm/cmake/config-ix.cmake @@ -53,6 +53,7 @@ check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(sysexits.h HAVE_SYSEXITS_H) check_include_file(termios.h HAVE_TERMIOS_H) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) Index: llvm/include/llvm/Support/ExitCodes.h =================================================================== --- /dev/null +++ llvm/include/llvm/Support/ExitCodes.h @@ -0,0 +1,31 @@ +//===-- llvm/Support/ExitCodes.h - Exit codes for exit() -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file contains definitions of exit codes for exit() function. They are +/// either defined by sysexits.h if it is supported, or defined here if +/// sysexits.h is not supported. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_EXITCODES_H +#define LLVM_SUPPORT_EXITCODES_H + +#if HAVE_SYSEXITS_H +#include +#elif __MVS__ +// does not exist on z/OS. The only value used in LLVM is +// EX_IOERR, which is used to signal a special error condition (broken pipe). +// Define the macro with its usual value from BSD systems, which is chosen to +// not clash with more standard exit codes like 1. +#define EX_IOERR 74 +#elif LLVM_ON_UNIX +#error Exit code EX_IOERR not available +#endif + +#endif Index: llvm/lib/Support/CrashRecoveryContext.cpp =================================================================== --- llvm/lib/Support/CrashRecoveryContext.cpp +++ llvm/lib/Support/CrashRecoveryContext.cpp @@ -9,14 +9,12 @@ #include "llvm/Support/CrashRecoveryContext.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ExitCodes.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Signals.h" #include "llvm/Support/ThreadLocal.h" #include #include -#if LLVM_ON_UNIX -#include // EX_IOERR -#endif using namespace llvm; Index: llvm/lib/Support/Unix/Signals.inc =================================================================== --- llvm/lib/Support/Unix/Signals.inc +++ llvm/lib/Support/Unix/Signals.inc @@ -36,6 +36,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Config/config.h" #include "llvm/Demangle/Demangle.h" +#include "llvm/Support/ExitCodes.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/Format.h" @@ -46,7 +47,6 @@ #include "llvm/Support/raw_ostream.h" #include #include -#include #ifdef HAVE_BACKTRACE # include BACKTRACE_HEADER // For backtrace(). #endif