[libc-commits] [libc] [libc] warn when depending on public entrypoints (PR #146163)

via libc-commits libc-commits at lists.llvm.org
Fri Jun 27 18:06:04 PDT 2025


================
@@ -1,4 +1,32 @@
 set(OBJECT_LIBRARY_TARGET_TYPE "OBJECT_LIBRARY")
+set(ENTRYPOINT_OBJ_TARGET_TYPE "ENTRYPOINT_OBJ")
+set(ENTRYPOINT_EXT_TARGET_TYPE "ENTRYPOINT_EXT")
+
+# Rule to check if a list of dependencies contains any entrypoint objects. Returns a list in entrypoint_deps.
+function(check_entrypoint_deps fq_deps_list)
+  set(PUBLIC_DEPS "")
+  foreach(dep IN LISTS fq_deps_list)
+    if(NOT TARGET ${dep})
+      continue()
+    endif()
+    #don't warn for deps that are allowed, such as errno
+    set(ALLOWED_DEPS
+      "libc.src.errno.errno"
+      "libc.src.setjmp.longjmp"
+    )
+    LIST(FIND ALLOWED_DEPS ${dep} dep_index)
----------------
lntue wrote:

before the `foreach` loop, you can remove the `ALLOWED_DEPS` list from the input list:
```
list(REMOVE_ITEM fq_dep_list ${ALLOWED_DEPS})
```

https://github.com/llvm/llvm-project/pull/146163


More information about the libc-commits mailing list