From: Ryan Whittaker <
ryan...@linux.ibm.com>
Building PowerPC utils locally on a new Linux distro encountered
errors and later compiler warnings from GCC15. This commit solves
the following issues:
Rtas event function pointers defined with incorrect argument types.
Function pointers used to retrieve functions from librtasevent were
defined without parameters, yet, the functions assigned to them had
various parameters. The correct parameter types were defined. The
librtasevent header file was also included to give access to the
rtas_event struct type.
Typo in a define directive. PLARFORM -> PLATFORM.
The compiler issued a strcpy warning that the result of strncpy could be
truncated if there isn't enough space in the destination string. This
warning is unnecessary because the strings are all defined with exactly
enough space for their results. These warnings were suppressed.
Signed-off-by: Ryan Whittaker <
ryan...@linux.ibm.com>
Reviewed-by: Mingming Cao <
m...@linux.ibm.com>
---
src/common/pseries_platform.h | 2 +-
src/nvram.c | 11 ++++++-----
src/sys_ident.c | 3 +++
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/common/pseries_platform.h b/src/common/pseries_platform.h
index 440c3e6..5fa12ff 100644
--- a/src/common/pseries_platform.h
+++ b/src/common/pseries_platform.h
@@ -19,7 +19,7 @@
*/
#ifndef PLATFORM_H
-#define PLARFORM_H
+#define PLATFORM_H
#define PLATFORM_FILE "/proc/cpuinfo"
diff --git a/src/nvram.c b/src/nvram.c
index 1987c3d..efd88c0 100644
--- a/src/nvram.c
+++ b/src/nvram.c
@@ -64,6 +64,7 @@
#endif
#include <stdbool.h>
+#include "librtasevent.h"
#include "nvram.h"
/**
@@ -890,22 +891,22 @@ dump_errlog(struct nvram *nvram)
* dump_rtas_event_entry
* @brief Dump event-scan data.
*
- * Note: This is really only valid for PAPR machines. To ensure
+ * Note: This is really only valid for PAPR machines. To ensure
* the nvram command can run on all powerpc machines we dlopen the
* the librtasevent library to dump the rtas event.
*
* @param data pointer to rtas error to dump
* @param len length of data buffer
- * @return 0 on success, !0 otherwise
+ * @return 0 on success, !0 otherwise
*/
int
dump_rtas_event_entry(char *data, int len)
{
void *rtas_event;
void *handle;
- void *(*parse_rtas_event)();
- void (*rtas_print_event)();
- void (*cleanup_rtas_event)();
+ void *(*parse_rtas_event)(char*, int);
+ void (*rtas_print_event)(FILE*, struct rtas_event*, int);
+ void (*cleanup_rtas_event)(struct rtas_event*);
handle = dlopen("/usr/lib/librtasevent.so", RTLD_LAZY);
if (handle == NULL)
diff --git a/src/sys_ident.c b/src/sys_ident.c
index 2c5c06b..5646ab5 100644
--- a/src/sys_ident.c
+++ b/src/sys_ident.c
@@ -320,6 +320,8 @@ print_proc_sn_value(void)
return 0;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
/**
* print_sys_part_id
* @brief Prints the unique system identification number
@@ -449,6 +451,7 @@ print_sys_part_id(void)
return 0;
}
+#pragma GCC diagnostic pop
int
main (int argc, char **argv)
--
2.39.5 (Apple Git-154)