diff mbox series

pseudo: Fix build with gcc-14

Message ID 20240203002938.3903103-1-raj.khem@gmail.com
State New
Headers show
Series pseudo: Fix build with gcc-14 | expand

Commit Message

Khem Raj Feb. 3, 2024, 12:29 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-Fix-build-warnings-seen-with-gcc-14.patch | 41 +++++++++++++++++++
 meta/recipes-devtools/pseudo/pseudo_git.bb    |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-devtools/pseudo/files/0001-pseudolog.c-Fix-build-warnings-seen-with-gcc-14.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/pseudo/files/0001-pseudolog.c-Fix-build-warnings-seen-with-gcc-14.patch b/meta/recipes-devtools/pseudo/files/0001-pseudolog.c-Fix-build-warnings-seen-with-gcc-14.patch
new file mode 100644
index 00000000000..d727a54d98d
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/0001-pseudolog.c-Fix-build-warnings-seen-with-gcc-14.patch
@@ -0,0 +1,41 @@ 
+From 60af912335f9564862e9159ec21737210080e965 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 1 Feb 2024 20:19:38 -0800
+Subject: [PATCH] pseudolog.c: Fix build warnings seen with gcc-14
+
+Define _XOPEN_SOURCE or we do not get strptime() signature defined
+resulting in implicit-function-declaration which is an error in gcc-14
+
+Swap the parameters of calloc call to fix calloc-transposed-args warning
+
+pseudolog.c: In function 'plog_trait':
+pseudolog.c:378:34: warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
+  378 |         new_trait = calloc(sizeof(*new_trait), 1);
+      |                                  ^
+pseudolog.c:378:34: note: earlier argument should specify number of elements, later size of each element
+
+Upstream-Status: Submitted [https://lore.kernel.org/openembedded-core/20240202043130.398590-1-raj.khem@gmail.com/T/#u]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ pseudolog.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/pseudolog.c
++++ b/pseudolog.c
+@@ -9,6 +9,7 @@
+ /* We need _XOPEN_SOURCE for strptime(), but if we define that,
+  * we then don't get S_IFSOCK... _GNU_SOURCE turns on everything. */
+ #define _DEFAULT_SOURCE
++#define _XOPEN_SOURCE
+ 
+ #include <ctype.h>
+ #include <limits.h>
+@@ -374,7 +375,7 @@ plog_trait(int opt, char *string) {
+ 		pseudo_diag("invalid empty string for -%c\n", opt);
+ 		return 0;
+ 	}
+-	new_trait = calloc(sizeof(*new_trait), 1);
++	new_trait = calloc(1, sizeof(*new_trait));
+ 	if (!new_trait) {
+ 		pseudo_diag("Couldn't allocate requested trait (for -%c %s)\n",
+ 			opt, string ? string : "<nil>");
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index f15fb0aaee5..8d1160944c5 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -4,6 +4,7 @@  SRC_URI = "git://git.yoctoproject.org/pseudo;branch=master;protocol=https \
            file://0001-configure-Prune-PIE-flags.patch \
            file://glibc238.patch \
            file://0001-ports-linux-add-wrapper-for-statvfs64.patch \
+           file://0001-pseudolog.c-Fix-build-warnings-seen-with-gcc-14.patch \
            file://fallback-passwd \
            file://fallback-group \
            "