[libcxx-commits] [libcxx] [libc++] Remove unnecessary includes from <atomic> (PR #82880)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Feb 24 05:49:30 PST 2024
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/82880
This reduces the include time of `<atomic>` from 135ms to 88ms.
>From 2053e91baf5ca4796733b99cf1ea58dd3b627882 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 24 Feb 2024 14:47:48 +0100
Subject: [PATCH] [libc++] Remove unnecessary includes from <atomic>
---
libcxx/include/__atomic/aliases.h | 1 -
libcxx/include/__thread/support/pthread.h | 4 +++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libcxx/include/__atomic/aliases.h b/libcxx/include/__atomic/aliases.h
index 0fa289de54b0f1..a87099802737aa 100644
--- a/libcxx/include/__atomic/aliases.h
+++ b/libcxx/include/__atomic/aliases.h
@@ -18,7 +18,6 @@
#include <__type_traits/make_unsigned.h>
#include <cstddef>
#include <cstdint>
-#include <cstdlib>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__thread/support/pthread.h b/libcxx/include/__thread/support/pthread.h
index d0b8367e448f48..e82e8152f44007 100644
--- a/libcxx/include/__thread/support/pthread.h
+++ b/libcxx/include/__thread/support/pthread.h
@@ -30,7 +30,9 @@
// so libc++'s <math.h> usually absorbs atomic_wide_counter.h into the
// module with <math.h> and makes atomic_wide_counter.h invisible.
// Include <math.h> here to work around that.
-#include <math.h>
+#if __building_module(std)
+# include <math.h>
+#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
More information about the libcxx-commits
mailing list