[libcxx-commits] [libcxx] [libcxx] Remove the second inclusion of the system header (PR #120946)

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 23 01:04:09 PST 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/120946

This was introduced in #119025 and not only seems unnecessary, it broke the build with older versions of glibc.

>From 021696170444be63e6b4ef72f3504e504b232169 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Mon, 23 Dec 2024 01:03:24 -0800
Subject: [PATCH] [libcxx] Remove the second inclusion of the system header

This was introduced in #119025 and not only seems unnecessary, it broke
the build with older versions of glibc.
---
 libcxx/include/stdio.h  | 4 ----
 libcxx/include/stdlib.h | 4 ----
 libcxx/include/wchar.h  | 4 ----
 3 files changed, 12 deletions(-)

diff --git a/libcxx/include/stdio.h b/libcxx/include/stdio.h
index d1e57b08f5da47..32ab2af5b1865f 100644
--- a/libcxx/include/stdio.h
+++ b/libcxx/include/stdio.h
@@ -106,10 +106,6 @@ void perror(const char* s);
 #  ifndef _LIBCPP_STDIO_H
 #    define _LIBCPP_STDIO_H
 
-#    if __has_include_next(<stdio.h>)
-#      include_next <stdio.h>
-#    endif
-
 #    ifdef __cplusplus
 
 #      undef getc
diff --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h
index e32b7b7d751b3e..a37faa1c93aa56 100644
--- a/libcxx/include/stdlib.h
+++ b/libcxx/include/stdlib.h
@@ -92,10 +92,6 @@ void *aligned_alloc(size_t alignment, size_t size);                       // C11
 #  if !defined(_LIBCPP_STDLIB_H)
 #    define _LIBCPP_STDLIB_H
 
-#    if __has_include_next(<stdlib.h>)
-#      include_next <stdlib.h>
-#    endif
-
 #    ifdef __cplusplus
 extern "C++" {
 // abs
diff --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h
index 436027b7842aeb..cc72b44f4c6419 100644
--- a/libcxx/include/wchar.h
+++ b/libcxx/include/wchar.h
@@ -122,10 +122,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
 #    include <__mbstate_t.h> // provide mbstate_t
 #    include <stddef.h>      // provide size_t
 
-#    if __has_include_next(<wchar.h>)
-#      include_next <wchar.h>
-#    endif
-
 // Determine whether we have const-correct overloads for wcschr and friends.
 #    if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
 #      define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1



More information about the libcxx-commits mailing list