Skip to content

[CMake] Remove some unneeded HAVE_*_H #123282

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

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|
set(HAVE_MACH_MACH_H 0)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 1)
set(HAVE_SIGNAL_H 1)
set(HAVE_SYS_IOCTL_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYS_PARAM_H 1)
set(HAVE_SYS_RESOURCE_H 1)
set(HAVE_SYS_STAT_H 1)
set(HAVE_SYS_TIME_H 1)
set(HAVE_SYSEXITS_H 1)
set(HAVE_TERMIOS_H 1)
set(HAVE_UNISTD_H 1)
Expand All @@ -37,13 +33,9 @@ elseif (APPLE)
set(HAVE_MACH_MACH_H 1)
set(HAVE_MALLOC_MALLOC_H 1)
set(HAVE_PTHREAD_H 1)
set(HAVE_SIGNAL_H 1)
set(HAVE_SYS_IOCTL_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYS_PARAM_H 1)
set(HAVE_SYS_RESOURCE_H 1)
set(HAVE_SYS_STAT_H 1)
set(HAVE_SYS_TIME_H 1)
set(HAVE_SYSEXITS_H 1)
set(HAVE_TERMIOS_H 1)
set(HAVE_UNISTD_H 1)
Expand All @@ -52,13 +44,9 @@ elseif (PURE_WINDOWS)
set(HAVE_MACH_MACH_H 0)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 0)
set(HAVE_SIGNAL_H 1)
set(HAVE_SYS_IOCTL_H 0)
set(HAVE_SYS_MMAN_H 0)
set(HAVE_SYS_PARAM_H 0)
set(HAVE_SYS_RESOURCE_H 0)
set(HAVE_SYS_STAT_H 1)
set(HAVE_SYS_TIME_H 0)
set(HAVE_SYSEXITS_H 0)
set(HAVE_TERMIOS_H 0)
set(HAVE_UNISTD_H 0)
Expand All @@ -69,13 +57,9 @@ elseif (ZOS)
set(HAVE_MACH_MACH_H 0)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 1)
set(HAVE_SIGNAL_H 1)
set(HAVE_SYS_IOCTL_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYS_PARAM_H 0)
set(HAVE_SYS_RESOURCE_H 1)
set(HAVE_SYS_STAT_H 1)
set(HAVE_SYS_TIME_H 1)
set(HAVE_SYSEXITS_H 0)
set(HAVE_TERMIOS_H 1)
set(HAVE_UNISTD_H 1)
Expand All @@ -85,13 +69,9 @@ else()
check_include_file(mach/mach.h HAVE_MACH_MACH_H)
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/time.h HAVE_SYS_TIME_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)
Expand Down Expand Up @@ -364,7 +344,7 @@ check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
# Avoid sigaltstack on Apple platforms, where backtrace() cannot handle it
# (rdar://7089625) and _Unwind_Backtrace is unusable because it cannot unwind
# past the signal handler after an assertion failure (rdar://29866587).
if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE )
if( NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE )
check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
endif()
check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL)
Expand Down
6 changes: 0 additions & 6 deletions llvm/include/llvm/Config/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@
/* Define to 1 if you have the `sigaltstack' function. */
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}

/* Define to 1 if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H}

/* Define to 1 if you have the `strerror_r' function. */
#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R}

Expand All @@ -189,9 +186,6 @@
/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}

/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}

/* Define to 1 if stat struct has st_mtimespec member .*/
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}

Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/Support/Unix/Process.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@
#include <mutex>
#include <optional>
#include <fcntl.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <sys/stat.h>
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
#include <malloc.h>
#endif
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/Support/Unix/Program.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <fcntl.h>
#if HAVE_UNISTD_H
#include <unistd.h>
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/Support/Unix/Signals.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
#ifdef HAVE_BACKTRACE
#include BACKTRACE_HEADER // For backtrace().
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <sys/stat.h>
#if HAVE_DLFCN_H
#include <dlfcn.h>
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Support/Unix/Unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
#include <unistd.h>
#endif

#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <sys/time.h>
#include <time.h>

#ifdef HAVE_DLFCN_H
Expand Down
2 changes: 0 additions & 2 deletions llvm/unittests/Support/CrashRecoveryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
#endif

#ifdef LLVM_ON_UNIX
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#endif

using namespace llvm;
using namespace llvm::sys;
Expand Down
3 changes: 0 additions & 3 deletions llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ write_cmake_config("config") {
"HAVE_MALLCTL=",
"HAVE_PTHREAD_GET_NAME_NP=",
"HAVE_PTHREAD_SET_NAME_NP=",
"HAVE_SIGNAL_H=1",
"HAVE_VALGRIND_VALGRIND_H=",
"HAVE__ALLOCA=",
"HAVE___ALLOCA=",
Expand Down Expand Up @@ -225,7 +224,6 @@ write_cmake_config("config") {
"HAVE_SYS_IOCTL_H=",
"HAVE_SYS_MMAN_H=",
"HAVE_SYS_RESOURCE_H=",
"HAVE_SYS_TIME_H=",
"HAVE_TERMIOS_H=",
"HAVE_UNISTD_H=",
"HAVE__CHSIZE_S=1",
Expand Down Expand Up @@ -260,7 +258,6 @@ write_cmake_config("config") {
"HAVE_SYS_IOCTL_H=1",
"HAVE_SYS_MMAN_H=1",
"HAVE_SYS_RESOURCE_H=1",
"HAVE_SYS_TIME_H=1",
"HAVE_TERMIOS_H=1",
"HAVE_UNISTD_H=1",
"HAVE__CHSIZE_S=",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@
/* Define to 1 if you have the `sigaltstack' function. */
#define HAVE_SIGALTSTACK 1

/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1

/* Define to 1 if you have the `strerror_r' function. */
/* HAVE_STRERROR_R defined in Bazel */

Expand All @@ -192,9 +189,6 @@
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1

/* Define to 1 if stat struct has st_mtimespec member .*/
/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */

Expand Down
6 changes: 0 additions & 6 deletions utils/bazel/llvm_configs/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@
/* Define to 1 if you have the `sigaltstack' function. */
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}

/* Define to 1 if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H}

/* Define to 1 if you have the `strerror_r' function. */
#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R}

Expand All @@ -189,9 +186,6 @@
/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}

/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}

/* Define to 1 if stat struct has st_mtimespec member .*/
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}

Expand Down
Loading