[PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos

From: Daniel Gomez via B4 Relay
Date: Fri Sep 06 2024 - 07:03:22 EST


From: Daniel Gomez <da.gomez@xxxxxxxxxxx>

Use getprogname() [1] instead of program_invocation_short_name() [2]
for macOS hosts.

[1]:
https://www.gnu.org/software/gnulib/manual/html_node/
program_005finvocation_005fshort_005fname.html

[2]:
https://developer.apple.com/library/archive/documentation/System/
Conceptual/ManPages_iPhoneOS/man3/getprogname.3.html

Fixes build error for macOS hosts:

drivers/gpu/drm/xe/xe_gen_wa_oob.c:34:3: error: use of
undeclared identifier 'program_invocation_short_name' 34 |
program_invocation_short_name); | ^ 1 error
generated.

Signed-off-by: Daniel Gomez <da.gomez@xxxxxxxxxxx>
Reviewed-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>
---
drivers/gpu/drm/xe/xe_gen_wa_oob.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
index 904cf47925aa..0d933644d8a0 100644
--- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
+++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
@@ -8,6 +8,7 @@
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>

#define HEADER \
@@ -30,6 +31,9 @@

static void print_usage(FILE *f)
{
+#ifdef __APPLE__
+ const char *program_invocation_short_name = getprogname();
+#endif
fprintf(f, "usage: %s <input-rule-file> <generated-c-source-file> <generated-c-header-file>\n",
program_invocation_short_name);
}

--
2.46.0