[libc-commits] [libc] [libc] Add program_invocation(_short)_name and tweak err.h functions (PR #212448)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Mon Aug 3 02:16:12 PDT 2026
================
@@ -23,21 +23,21 @@
#include "src/__support/printf_core/printf_main.h"
#include "src/__support/printf_core/writer.h"
-#ifdef __linux__
+#ifdef LIBC_FULL_BUILD
+#include "src/errno/program_invocation_short_name.h"
+#define PROGRAM_INVOCATION_SHORT_NAME \
+ LIBC_NAMESPACE::program_invocation_short_name
+#else
extern "C" char *program_invocation_short_name;
+#define PROGRAM_INVOCATION_SHORT_NAME ::program_invocation_short_name
#endif
namespace LIBC_NAMESPACE_DECL {
namespace err_reporting {
void report(bool show_err, int err_num, const char *fmt,
internal::ArgList &args) {
- const char *progname = "libllvmlibc";
- // TODO: Use a proper way to get progname if available.
-#ifdef __linux__
- progname = program_invocation_short_name;
-#endif
-
+ const char *progname = PROGRAM_INVOCATION_SHORT_NAME;
----------------
labath wrote:
Using "" as a backup, in light of the other comment.
https://github.com/llvm/llvm-project/pull/212448
More information about the libc-commits
mailing list