Skip to content

Commit 1e53f95

Browse files
authored
[CMake] Remove some always-true HAVE_XXX_H
These are unneeded even on AIX, PURE_WINDOWS, and ZOS (per llvm#104706) * HAVE_ERRNO_H: introduced by 1a93330 (2009) but unneeded. The guarded ABI is unconditionally used by lldb. * HAVE_FCNTL_H * HAVE_FENV_H * HAVE_SYS_STAT_H Pull Request: llvm#123087
1 parent ac2165f commit 1e53f95

File tree

15 files changed

+5
-76
lines changed

15 files changed

+5
-76
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ endif()
5959

6060
# include checks
6161
check_include_file(dlfcn.h HAVE_DLFCN_H)
62-
check_include_file(errno.h HAVE_ERRNO_H)
63-
check_include_file(fcntl.h HAVE_FCNTL_H)
6462
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
6563
if( NOT PURE_WINDOWS )
6664
check_include_file(pthread.h HAVE_PTHREAD_H)
@@ -69,13 +67,11 @@ check_include_file(signal.h HAVE_SIGNAL_H)
6967
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
7068
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
7169
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
72-
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
7370
check_include_file(sys/time.h HAVE_SYS_TIME_H)
7471
check_include_file(sysexits.h HAVE_SYSEXITS_H)
7572
check_include_file(termios.h HAVE_TERMIOS_H)
7673
check_include_file(unistd.h HAVE_UNISTD_H)
7774
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
78-
check_include_file(fenv.h HAVE_FENV_H)
7975
check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT)
8076
check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
8177
check_c_source_compiles("

llvm/include/llvm/Config/config.h.cmake

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,6 @@
7272
/* Define if __unw_add_dynamic_fde() is available on this platform. */
7373
#cmakedefine HAVE_UNW_ADD_DYNAMIC_FDE ${HAVE_UNW_ADD_DYNAMIC_FDE}
7474

75-
/* Define to 1 if you have the <errno.h> header file. */
76-
#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H}
77-
78-
/* Define to 1 if you have the <fcntl.h> header file. */
79-
#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
80-
81-
/* Define to 1 if you have the <fenv.h> header file. */
82-
#cmakedefine HAVE_FENV_H ${HAVE_FENV_H}
83-
8475
/* Define if libffi is available on this platform. */
8576
#cmakedefine HAVE_FFI_CALL ${HAVE_FFI_CALL}
8677

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

201-
/* Define to 1 if you have the <sys/stat.h> header file. */
202-
#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}
203-
204192
/* Define to 1 if you have the <sys/time.h> header file. */
205193
#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}
206194

llvm/include/llvm/Support/FileSystem.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
#include <system_error>
4545
#include <vector>
4646

47-
#ifdef HAVE_SYS_STAT_H
4847
#include <sys/stat.h>
49-
#endif
5048

5149
namespace llvm {
5250
namespace sys {

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ Constant *GetConstantFoldFPValue128(float128 V, Type *Ty) {
18851885

18861886
/// Clear the floating-point exception state.
18871887
inline void llvm_fenv_clearexcept() {
1888-
#if defined(HAVE_FENV_H) && HAVE_DECL_FE_ALL_EXCEPT
1888+
#if HAVE_DECL_FE_ALL_EXCEPT
18891889
feclearexcept(FE_ALL_EXCEPT);
18901890
#endif
18911891
errno = 0;
@@ -1896,7 +1896,7 @@ inline bool llvm_fenv_testexcept() {
18961896
int errno_val = errno;
18971897
if (errno_val == ERANGE || errno_val == EDOM)
18981898
return true;
1899-
#if defined(HAVE_FENV_H) && HAVE_DECL_FE_ALL_EXCEPT && HAVE_DECL_FE_INEXACT
1899+
#if HAVE_DECL_FE_ALL_EXCEPT && HAVE_DECL_FE_INEXACT
19001900
if (fetestexcept(FE_ALL_EXCEPT & ~FE_INEXACT))
19011901
return true;
19021902
#endif

llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
#ifdef __linux__
2121
// These includes used by RTDyldMemoryManager::getPointerToNamedFunction()
2222
// for Glibc trickery. See comments in this function for more information.
23-
#ifdef HAVE_SYS_STAT_H
24-
#include <sys/stat.h>
25-
#endif
26-
#include <fcntl.h>
27-
#include <unistd.h>
23+
#include <fcntl.h>
24+
#include <sys/stat.h>
25+
#include <unistd.h>
2826
#endif
2927

3028
namespace llvm {

llvm/lib/Support/Errno.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
#include "llvm/Support/Errno.h"
1414
#include "llvm/Config/config.h"
1515
#include <cstring>
16-
17-
#if HAVE_ERRNO_H
1816
#include <errno.h>
19-
#endif
2017

2118
//===----------------------------------------------------------------------===//
2219
//=== WARNING: Implementation here must contain only TRULY operating system
@@ -26,11 +23,9 @@
2623
namespace llvm {
2724
namespace sys {
2825

29-
#if HAVE_ERRNO_H
3026
std::string StrError() {
3127
return StrError(errno);
3228
}
33-
#endif // HAVE_ERRNO_H
3429

3530
std::string StrError(int errnum) {
3631
std::string str;

llvm/lib/Support/Unix/Path.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@
1818
#include "Unix.h"
1919
#include <limits.h>
2020
#include <stdio.h>
21-
#if HAVE_SYS_STAT_H
2221
#include <sys/stat.h>
23-
#endif
24-
#if HAVE_FCNTL_H
2522
#include <fcntl.h>
26-
#endif
2723
#ifdef HAVE_UNISTD_H
2824
#include <unistd.h>
2925
#endif

llvm/lib/Support/Unix/Process.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@
1717
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_THREADS
1818
#include <mutex>
1919
#include <optional>
20-
#if HAVE_FCNTL_H
2120
#include <fcntl.h>
22-
#endif
2321
#ifdef HAVE_SYS_TIME_H
2422
#include <sys/time.h>
2523
#endif
2624
#ifdef HAVE_SYS_RESOURCE_H
2725
#include <sys/resource.h>
2826
#endif
29-
#ifdef HAVE_SYS_STAT_H
3027
#include <sys/stat.h>
31-
#endif
3228
#if HAVE_SIGNAL_H
3329
#include <signal.h>
3430
#endif

llvm/lib/Support/Unix/Program.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,14 @@
2828
#include "llvm/Support/StringSaver.h"
2929
#include "llvm/Support/SystemZ/zOSSupport.h"
3030
#include "llvm/Support/raw_ostream.h"
31-
#if HAVE_SYS_STAT_H
3231
#include <sys/stat.h>
33-
#endif
3432
#if HAVE_SYS_RESOURCE_H
3533
#include <sys/resource.h>
3634
#endif
3735
#if HAVE_SIGNAL_H
3836
#include <signal.h>
3937
#endif
40-
#if HAVE_FCNTL_H
4138
#include <fcntl.h>
42-
#endif
4339
#if HAVE_UNISTD_H
4440
#include <unistd.h>
4541
#endif

llvm/lib/Support/Unix/Signals.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@
5353
#if HAVE_SIGNAL_H
5454
#include <signal.h>
5555
#endif
56-
#if HAVE_SYS_STAT_H
5756
#include <sys/stat.h>
58-
#endif
5957
#if HAVE_DLFCN_H
6058
#include <dlfcn.h>
6159
#endif

llvm/lib/Support/Unix/Unix.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545
# include <dlfcn.h>
4646
#endif
4747

48-
#ifdef HAVE_FCNTL_H
4948
# include <fcntl.h>
50-
#endif
5149

5250
/// This function builds an error message into \p ErrMsg using the \p prefix
5351
/// string and the Unix error number given by \p errnum. If errnum is -1, the

llvm/lib/Support/raw_ostream.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
#include <sys/stat.h>
3131

3232
// <fcntl.h> may provide O_BINARY.
33-
#if defined(HAVE_FCNTL_H)
3433
# include <fcntl.h>
35-
#endif
3634

3735
#if defined(HAVE_UNISTD_H)
3836
# include <unistd.h>

llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ write_cmake_config("config") {
8989
"HAVE_DECL_FE_ALL_EXCEPT=1",
9090
"HAVE_DECL_FE_INEXACT=1",
9191
"LLVM_ENABLE_CRASH_DUMPS=",
92-
"HAVE_ERRNO_H=1",
93-
"HAVE_FCNTL_H=1",
94-
"HAVE_FENV_H=1",
9592
"HAVE_FFI_CALL=",
9693
"HAVE_FFI_FFI_H=",
9794
"HAVE_FFI_H=",
@@ -101,7 +98,6 @@ write_cmake_config("config") {
10198
"HAVE_PTHREAD_GET_NAME_NP=",
10299
"HAVE_PTHREAD_SET_NAME_NP=",
103100
"HAVE_SIGNAL_H=1",
104-
"HAVE_SYS_STAT_H=1",
105101
"HAVE_VALGRIND_VALGRIND_H=",
106102
"HAVE__ALLOCA=",
107103
"HAVE___ALLOCA=",

utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,6 @@
8484
/* Define if __unw_add_dynamic_fde() is available on this platform. */
8585
/* HAVE_UNW_ADD_DYNAMIC_FDE defined in Bazel */
8686

87-
/* Define to 1 if you have the <errno.h> header file. */
88-
#define HAVE_ERRNO_H 1
89-
90-
/* Define to 1 if you have the <fcntl.h> header file. */
91-
#define HAVE_FCNTL_H 1
92-
93-
/* Define to 1 if you have the <fenv.h> header file. */
94-
#define HAVE_FENV_H 1
95-
9687
/* Define if libffi is available on this platform. */
9788
/* #undef HAVE_FFI_CALL */
9889

@@ -201,9 +192,6 @@
201192
/* Define to 1 if you have the <sys/resource.h> header file. */
202193
#define HAVE_SYS_RESOURCE_H 1
203194

204-
/* Define to 1 if you have the <sys/stat.h> header file. */
205-
#define HAVE_SYS_STAT_H 1
206-
207195
/* Define to 1 if you have the <sys/time.h> header file. */
208196
#define HAVE_SYS_TIME_H 1
209197

utils/bazel/llvm_configs/config.h.cmake

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,6 @@
7272
/* Define if __unw_add_dynamic_fde() is available on this platform. */
7373
#cmakedefine HAVE_UNW_ADD_DYNAMIC_FDE ${HAVE_UNW_ADD_DYNAMIC_FDE}
7474

75-
/* Define to 1 if you have the <errno.h> header file. */
76-
#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H}
77-
78-
/* Define to 1 if you have the <fcntl.h> header file. */
79-
#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
80-
81-
/* Define to 1 if you have the <fenv.h> header file. */
82-
#cmakedefine HAVE_FENV_H ${HAVE_FENV_H}
83-
8475
/* Define if libffi is available on this platform. */
8576
#cmakedefine HAVE_FFI_CALL ${HAVE_FFI_CALL}
8677

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

201-
/* Define to 1 if you have the <sys/stat.h> header file. */
202-
#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}
203-
204192
/* Define to 1 if you have the <sys/time.h> header file. */
205193
#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}
206194

0 commit comments

Comments
 (0)