[libc-commits] [libc] [libc] Remove unused target conditionals for Apple platforms (PR #119030)
Louis Dionne via libc-commits
libc-commits at lists.llvm.org
Fri Dec 6 12:54:44 PST 2024
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/119030
It seems that LIBC_TARGET_OS_IS_MACOS and LIBC_TARGET_OS_IS_IPHONE were never actually used in the code, so these definitions can be removed.
I came across these because libc++ now depends on llvm-libc to build (for from_chars), and the unguarded use of TargetConditionals.h broke some of our downstream configurations. There are some platforms for which __APPLE__ is defined but that don't provide TargetConditionals.h.
If there is a need to keep defining those, the compiler also provides some uglier macro definitions like __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ that do not require including any header.
>From 716276974e62473a086f5a9ec9bcc905519c2c81 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 6 Dec 2024 15:48:49 -0500
Subject: [PATCH] [libc] Remove unused target conditionals for Apple platforms
It seems that LIBC_TARGET_OS_IS_MACOS and LIBC_TARGET_OS_IS_IPHONE were
never actually used in the code, so these definitions can be removed.
I came across these because libc++ now depends on llvm-libc to build
(for from_chars), and the unguarded use of TargetConditionals.h broke
some of our downstream configurations. There are some platforms for
which __APPLE__ is defined but that don't provide TargetConditionals.h.
If there is a need to keep defining those, the compiler also provides
some uglier macro definitions like __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
that do not require including any header.
---
libc/src/__support/macros/properties/os.h | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/libc/src/__support/macros/properties/os.h b/libc/src/__support/macros/properties/os.h
index 1c8fd5721ce679..807ce1812735c0 100644
--- a/libc/src/__support/macros/properties/os.h
+++ b/libc/src/__support/macros/properties/os.h
@@ -25,18 +25,6 @@
#define LIBC_TARGET_OS_IS_WINDOWS
#endif
-#if (defined(__apple__) || defined(__APPLE__) || defined(__MACH__))
-// From https://stackoverflow.com/a/49560690
-#include "TargetConditionals.h"
-#if defined(TARGET_OS_OSX)
-#define LIBC_TARGET_OS_IS_MACOS
-#endif
-#if defined(TARGET_OS_IPHONE)
-// This is set for any non-Mac Apple products (IOS, TV, WATCH)
-#define LIBC_TARGET_OS_IS_IPHONE
-#endif
-#endif
-
#if defined(__Fuchsia__)
#define LIBC_TARGET_OS_IS_FUCHSIA
#endif
More information about the libc-commits
mailing list