[libc-commits] [libc] 13bbca8 - [libc] [NFC] explain compiler macros in limits.h

Alfred Persson Forsberg via libc-commits libc-commits at lists.llvm.org
Wed Aug 16 16:23:40 PDT 2023


Author: Alfred Persson Forsberg
Date: 2023-08-17T01:23:30+02:00
New Revision: 13bbca8d694b4ef2ad03ec1805f07da8640c1a31

URL: https://github.com/llvm/llvm-project/commit/13bbca8d694b4ef2ad03ec1805f07da8640c1a31
DIFF: https://github.com/llvm/llvm-project/commit/13bbca8d694b4ef2ad03ec1805f07da8640c1a31.diff

LOG: [libc] [NFC] explain compiler macros in limits.h

Differential Revision: https://reviews.llvm.org/D158128

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/limits-macros.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
index 74b0a0f36a74f9..7179d3963c7383 100644
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ b/libc/include/llvm-libc-macros/limits-macros.h
@@ -1,6 +1,12 @@
 #ifndef __LLVM_LIBC_MACROS_LIMITS_MACROS_H
 #define __LLVM_LIBC_MACROS_LIMITS_MACROS_H
 
+// Normally compiler headers will be prefered over LLVM-libc headers and
+// include_next this header, however, during LLVM-libc build itself the
+// LLVM-libc headers are prefered, and to get C numerical limits we need to
+// include compiler (freestanding) limits.h. The macro checks are here to avoid
+// including limits.h when compiler headers have already been included.
+
 #if !defined _GCC_LIMITS_H_ && !defined __CLANG_LIMITS_H &&                    \
     __has_include_next(<limits.h>)
 #include_next <limits.h>


        


More information about the libc-commits mailing list