[libc-commits] [libc] [libc] Add program_invocation(_short)_name and tweak err.h functions (PR #212448)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Mon Aug 3 06:04:33 PDT 2026


================
@@ -23,21 +23,23 @@
 #include "src/__support/printf_core/printf_main.h"
 #include "src/__support/printf_core/writer.h"
 
-#ifdef __linux__
+#ifdef LIBC_FULL_BUILD
----------------
kaladron wrote:

Instead of relying on the define swapping out the variable, I wonder if it's cleaner to do:

```c++
LIBC_INLINE const char *get_program_invocation_short_name() {
#ifdef LIBC_FULL_BUILD
  return LIBC_NAMESPACE::program_invocation_short_name;
#elif defined(__GLIBC__)
  return ::program_invocation_short_name;
#else
  return "";
#endif
}
```

Which would also cover non-glibc overlay.

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


More information about the libc-commits mailing list