[libc-commits] [PATCH] D158128: [libc] [NFC] explain compiler macros in limits.h

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


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG13bbca8d694b: [libc] [NFC] explain compiler macros in limits.h (authored by alfredfo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158128/new/

https://reviews.llvm.org/D158128

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


Index: libc/include/llvm-libc-macros/limits-macros.h
===================================================================
--- libc/include/llvm-libc-macros/limits-macros.h
+++ 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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158128.550930.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230816/9ac6acd7/attachment.bin>


More information about the libc-commits mailing list