From 7ad1dc7693b7b04199681df474122248634a9808 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 4 Sep 2023 14:40:27 +0200 Subject: [PATCH] fix: cmake config.h defines declaration --- .gitignore | 1 + cmake/config.h.in | 73 ++++++++++++------------------ src/base/logging.h | 2 +- src/base/sysinfo.cc | 2 +- src/getpc.h | 4 +- src/malloc_hook.cc | 2 +- src/profile-handler.cc | 4 +- src/profiler.cc | 4 +- src/stacktrace_generic_fp-inl.h | 4 +- src/stacktrace_powerpc-linux-inl.h | 4 +- 10 files changed, 44 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index e25ce99..331474a 100644 --- a/.gitignore +++ b/.gitignore @@ -150,3 +150,4 @@ /unique_path_unittest.exe /unwind_bench /unwind_bench.exe +/build diff --git a/cmake/config.h.in b/cmake/config.h.in index c3156ca..33e0c26 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -28,10 +28,10 @@ #cmakedefine ENABLE_SIZED_DELETE /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_ASM_PTRACE_H +#cmakedefine HAVE_ASM_PTRACE_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_CYGWIN_SIGNAL_H +#cmakedefine HAVE_CYGWIN_SIGNAL_H /* Define to 1 if you have the declaration of `backtrace', and to 0 if you don't. */ @@ -65,32 +65,26 @@ */ #cmakedefine01 HAVE_DECL_VALLOC -/* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_DLFCN_H - -/* Define to 1 if the system has the type `Elf32_Versym'. */ -#cmakedefine01 HAVE_ELF32_VERSYM - /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_EXECINFO_H +#cmakedefine HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_FCNTL_H +#cmakedefine HAVE_FCNTL_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_FEATURES_H +#cmakedefine HAVE_FEATURES_H /* Define to 1 if you have the `fork' function. */ -#cmakedefine01 HAVE_FORK +#cmakedefine HAVE_FORK /* Define to 1 if you have the `geteuid' function. */ -#cmakedefine01 HAVE_GETEUID +#cmakedefine HAVE_GETEUID /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_GLOB_H +#cmakedefine HAVE_GLOB_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_GRP_H +#cmakedefine HAVE_GRP_H /* Define to 1 if you have the header file. */ #cmakedefine01 HAVE_LIBUNWIND_H @@ -101,84 +95,77 @@ #cmakedefine01 HAVE_LINUX_SIGEV_THREAD_ID /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_MALLOC_H +#cmakedefine HAVE_MALLOC_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_MALLOC_MALLOC_H - -/* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_MEMORY_H +#cmakedefine HAVE_MALLOC_MALLOC_H /* Define to 1 if you have a working `mmap' system call. */ -#cmakedefine01 HAVE_MMAP +#cmakedefine HAVE_MMAP /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_POLL_H +#cmakedefine HAVE_POLL_H /* define if libc has program_invocation_name */ -#cmakedefine01 HAVE_PROGRAM_INVOCATION_NAME +#cmakedefine HAVE_PROGRAM_INVOCATION_NAME /* Define if you have POSIX threads libraries and header files. */ -#cmakedefine01 HAVE_PTHREAD +#cmakedefine HAVE_PTHREAD /* defined to 1 if pthread symbols are exposed even without include pthread.h */ -#cmakedefine01 HAVE_PTHREAD_DESPITE_ASKING_FOR +#cmakedefine HAVE_PTHREAD_DESPITE_ASKING_FOR /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_PWD_H +#cmakedefine HAVE_PWD_H /* Define to 1 if you have the `sbrk' function. */ -#cmakedefine01 HAVE_SBRK +#cmakedefine HAVE_SBRK /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SCHED_H +#cmakedefine HAVE_SCHED_H -/* Define to 1 if you have the header file. */ /* Define to 1 if the system has the type `struct mallinfo'. */ -#cmakedefine01 HAVE_STRUCT_MALLINFO +#cmakedefine HAVE_STRUCT_MALLINFO /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_CDEFS_H +#cmakedefine HAVE_SYS_CDEFS_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_MALLOC_H +#cmakedefine HAVE_SYS_MALLOC_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_RESOURCE_H +#cmakedefine HAVE_SYS_RESOURCE_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_STAT_H +#cmakedefine HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #cmakedefine01 HAVE_SYS_SYSCALL_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_TYPES_H +#cmakedefine HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #cmakedefine01 HAVE_SYS_UCONTEXT_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_SYS_WAIT_H +#cmakedefine HAVE_SYS_WAIT_H /* Define to 1 if compiler supports __thread */ -#cmakedefine01 HAVE_TLS +#cmakedefine HAVE_TLS /* Define to 1 if you have the header file. */ #cmakedefine01 HAVE_UCONTEXT_H /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_UNISTD_H +#cmakedefine HAVE_UNISTD_H /* Whether contains _Unwind_Backtrace */ #cmakedefine HAVE_UNWIND_BACKTRACE /* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_UNWIND_H +#cmakedefine HAVE_UNWIND_H /* define if your compiler has __attribute__ */ #cmakedefine HAVE___ATTRIBUTE__ @@ -187,7 +174,7 @@ #cmakedefine HAVE___ATTRIBUTE__ALIGNED_FN /* Define to 1 if compiler supports __environ */ -#cmakedefine01 HAVE___ENVIRON +#cmakedefine HAVE___ENVIRON /* Define to 1 if you have the `__sbrk' function. */ #cmakedefine01 HAVE___SBRK diff --git a/src/base/logging.h b/src/base/logging.h index 2d6bf2b..0ff8705 100644 --- a/src/base/logging.h +++ b/src/base/logging.h @@ -56,7 +56,7 @@ // do logging on a best-effort basis. #if defined(_MSC_VER) #define WRITE_TO_STDERR(buf, len) WriteToStderr(buf, len); // in port.cc -#elif defined(HAVE_SYS_SYSCALL_H) && !defined(__APPLE__) +#elif HAVE_SYS_SYSCALL_H && !defined(__APPLE__) #include #define WRITE_TO_STDERR(buf, len) syscall(SYS_write, STDERR_FILENO, buf, len) #else diff --git a/src/base/sysinfo.cc b/src/base/sysinfo.cc index a8c1cb6..e9c0578 100644 --- a/src/base/sysinfo.cc +++ b/src/base/sysinfo.cc @@ -88,7 +88,7 @@ // open/read/close can set errno, which may be illegal at this // time, so prefer making the syscalls directly if we can. -#ifdef HAVE_SYS_SYSCALL_H +#if HAVE_SYS_SYSCALL_H # include #endif #ifdef SYS_open // solaris 11, at least sometimes, only defines SYS_openat diff --git a/src/getpc.h b/src/getpc.h index a9342f9..6cd7493 100644 --- a/src/getpc.h +++ b/src/getpc.h @@ -54,9 +54,9 @@ #ifdef HAVE_ASM_PTRACE_H #include #endif -#if defined(HAVE_SYS_UCONTEXT_H) +#if HAVE_SYS_UCONTEXT_H #include -#elif defined(HAVE_UCONTEXT_H) +#elif HAVE_UCONTEXT_H #include // for ucontext_t (and also mcontext_t) #elif defined(HAVE_CYGWIN_SIGNAL_H) #include diff --git a/src/malloc_hook.cc b/src/malloc_hook.cc index e70e3f3..79917b6 100644 --- a/src/malloc_hook.cc +++ b/src/malloc_hook.cc @@ -38,7 +38,7 @@ #include #include -#ifdef HAVE_SYS_SYSCALL_H +#if HAVE_SYS_SYSCALL_H #include #endif diff --git a/src/profile-handler.cc b/src/profile-handler.cc index 1857c80..301fc84 100644 --- a/src/profile-handler.cc +++ b/src/profile-handler.cc @@ -178,7 +178,7 @@ class ProfileHandler { // Must be false if HAVE_LINUX_SIGEV_THREAD_ID is not defined. bool per_thread_timer_enabled_; -#ifdef HAVE_LINUX_SIGEV_THREAD_ID +#if HAVE_LINUX_SIGEV_THREAD_ID // this is used to destroy per-thread profiling timers on thread // termination pthread_key_t thread_timer_key; @@ -389,7 +389,7 @@ ProfileHandler::ProfileHandler() ProfileHandler::~ProfileHandler() { Reset(); -#ifdef HAVE_LINUX_SIGEV_THREAD_ID +#if HAVE_LINUX_SIGEV_THREAD_ID if (per_thread_timer_enabled_) { pthread_key_delete(thread_timer_key); } diff --git a/src/profiler.cc b/src/profiler.cc index 227deb2..2468067 100644 --- a/src/profiler.cc +++ b/src/profiler.cc @@ -44,9 +44,9 @@ #ifdef HAVE_UNISTD_H #include // for getpid() #endif -#if defined(HAVE_SYS_UCONTEXT_H) +#if HAVE_SYS_UCONTEXT_H #include -#elif defined(HAVE_UCONTEXT_H) +#elif HAVE_UCONTEXT_H #include #elif defined(HAVE_CYGWIN_SIGNAL_H) #include diff --git a/src/stacktrace_generic_fp-inl.h b/src/stacktrace_generic_fp-inl.h index e8bdf2f..c134519 100644 --- a/src/stacktrace_generic_fp-inl.h +++ b/src/stacktrace_generic_fp-inl.h @@ -35,9 +35,9 @@ #ifndef BASE_STACKTRACE_GENERIC_FP_INL_H_ #define BASE_STACKTRACE_GENERIC_FP_INL_H_ -#if defined(HAVE_SYS_UCONTEXT_H) +#if HAVE_SYS_UCONTEXT_H #include -#elif defined(HAVE_UCONTEXT_H) +#elif HAVE_UCONTEXT_H #include #endif diff --git a/src/stacktrace_powerpc-linux-inl.h b/src/stacktrace_powerpc-linux-inl.h index a301a46..883e7d2 100644 --- a/src/stacktrace_powerpc-linux-inl.h +++ b/src/stacktrace_powerpc-linux-inl.h @@ -48,9 +48,9 @@ #include #include -#if defined(HAVE_SYS_UCONTEXT_H) +#if HAVE_SYS_UCONTEXT_H #include -#elif defined(HAVE_UCONTEXT_H) +#elif HAVE_UCONTEXT_H #include // for ucontext_t #endif