[llvm] [CMake] Remove some unneeded HAVE_*_H (PR #123282)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 21:02:21 PST 2025
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/123282
None
>From f591ea23e58acbb6287e02ceebc78c23a27faab0 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Thu, 16 Jan 2025 21:02:10 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.5-bogner
---
llvm/cmake/config-ix.cmake | 22 +------------------
llvm/include/llvm/Config/config.h.cmake | 6 -----
llvm/lib/Support/Unix/Process.inc | 4 ----
llvm/lib/Support/Unix/Program.inc | 2 --
llvm/lib/Support/Unix/Signals.inc | 2 --
llvm/lib/Support/Unix/Unix.h | 4 +---
llvm/unittests/Support/CrashRecoveryTest.cpp | 2 --
.../llvm/include/llvm/Config/BUILD.gn | 3 ---
.../llvm/include/llvm/Config/config.h | 6 -----
utils/bazel/llvm_configs/config.h.cmake | 6 -----
10 files changed, 2 insertions(+), 55 deletions(-)
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 38f339d17c8529..51e0ba3b6b3350 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index d51d01017d9867..60b53c41de4fbe 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -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}
@@ -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}
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index 2c55059e055bc6..e1469644104430 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -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
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index 74312ed6238aef..10632e8fa7e039 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -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>
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index b66e858c965ffb..b2f68d25221a2f 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -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>
diff --git a/llvm/lib/Support/Unix/Unix.h b/llvm/lib/Support/Unix/Unix.h
index 4840b51f75908d..f16c7fcda22c32 100644
--- a/llvm/lib/Support/Unix/Unix.h
+++ b/llvm/lib/Support/Unix/Unix.h
@@ -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
diff --git a/llvm/unittests/Support/CrashRecoveryTest.cpp b/llvm/unittests/Support/CrashRecoveryTest.cpp
index a22e532ec4c831..ceafba5b36f113 100644
--- a/llvm/unittests/Support/CrashRecoveryTest.cpp
+++ b/llvm/unittests/Support/CrashRecoveryTest.cpp
@@ -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;
diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 350eaac84d6685..e89d84105e945f 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -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=",
@@ -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",
@@ -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=",
diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
index dba7129e4c87d1..38ae47fc8ae191 100644
--- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
+++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
@@ -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 */
@@ -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 */
diff --git a/utils/bazel/llvm_configs/config.h.cmake b/utils/bazel/llvm_configs/config.h.cmake
index d51d01017d9867..60b53c41de4fbe 100644
--- a/utils/bazel/llvm_configs/config.h.cmake
+++ b/utils/bazel/llvm_configs/config.h.cmake
@@ -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}
@@ -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}
More information about the llvm-commits
mailing list