[libc-commits] [libc] 4c0d805 - [libc] Do not redefine `wchar_t` when compiling in C++ (#110769)

via libc-commits libc-commits at lists.llvm.org
Tue Oct 1 17:28:46 PDT 2024


Author: Joseph Huber
Date: 2024-10-01T17:28:42-07:00
New Revision: 4c0d805a54aa7b55ad12684c4fb4413a10992f00

URL: https://github.com/llvm/llvm-project/commit/4c0d805a54aa7b55ad12684c4fb4413a10992f00
DIFF: https://github.com/llvm/llvm-project/commit/4c0d805a54aa7b55ad12684c4fb4413a10992f00.diff

LOG: [libc] Do not redefine `wchar_t` when compiling in C++ (#110769)

Summary:
This is a fundamental type in C++, so we can't redefine it.

Added: 
    

Modified: 
    libc/include/llvm-libc-types/wchar_t.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-types/wchar_t.h b/libc/include/llvm-libc-types/wchar_t.h
index faa40d96efc4d2..bf2633a1c244bf 100644
--- a/libc/include/llvm-libc-types/wchar_t.h
+++ b/libc/include/llvm-libc-types/wchar_t.h
@@ -9,6 +9,11 @@
 #ifndef LLVM_LIBC_TYPES_WCHAR_T_H
 #define LLVM_LIBC_TYPES_WCHAR_T_H
 
+// wchar_t is a fundamental type in C++.
+#ifndef __cplusplus
+
 typedef __WCHAR_TYPE__ wchar_t;
 
+#endif
+
 #endif // LLVM_LIBC_TYPES_WCHAR_T_H


        


More information about the libc-commits mailing list