linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] utest: fix build with musl + clang >=15
@ 2024-02-22 10:12 Miko Larsson via B4 Relay
  2024-02-22 10:12 ` [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h Miko Larsson via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-22 10:12 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

Clang 15 onwards defaults to -Werror=implicit-function-declaration
which, combined with musl not declaring all the stuff we need without
the missing includes and defines, breaks the utest build. This series
fixes thus by simply adding the missing stuff.

Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
---
Changes in v2:
- Better commit descriptions, messages
- Link to v1: https://lore.kernel.org/r/20240215-utest-fixes-v1-0-24678d859de2@gmail.com

---
Miko Larsson (3):
      utest/tracefs-utest: include linux/limits.h
      utest/tracefs-utest: define _LARGEFILE64_SOURCE
      utest/trace-utest: include libgen.h

 utest/trace-utest.c   | 1 +
 utest/tracefs-utest.c | 4 ++++
 2 files changed, 5 insertions(+)
---
base-commit: 5f27b7f3fb7d88b29522baf3883cc0e2e28b1af0
change-id: 20240215-utest-fixes-893315be225b

Best regards,
-- 
Miko Larsson <mikoxyzzz@gmail.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h
  2024-02-22 10:12 [PATCH v2 0/3] utest: fix build with musl + clang >=15 Miko Larsson via B4 Relay
@ 2024-02-22 10:12 ` Miko Larsson via B4 Relay
  2024-02-22 14:53   ` Steven Rostedt
  2024-02-22 10:12 ` [PATCH v2 2/3] utest/tracefs-utest: define _LARGEFILE64_SOURCE Miko Larsson via B4 Relay
  2024-02-22 10:12 ` [PATCH v2 3/3] utest/trace-utest: include libgen.h Miko Larsson via B4 Relay
  2 siblings, 1 reply; 7+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-22 10:12 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

From: Miko Larsson <mikoxyzzz@gmail.com>

This fixes the build with musl + clang >=15; musl doesn't define
PATH_MAX anywhere else, and clang >=15 doesn't allow implicit
declarations with >=c99. Without this, the build fails due to PATH_MAX
not being defined.

We could include limits.h from the libc, but AFAIK the libc doesn't
necessarily have to define PATH_MAX, so it's safer to just include
linux/limits.h

Fixes: 845f16976929 ("libtracefs: Add unit tests")
Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
---
 utest/tracefs-utest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 963fac7..70bcf3e 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -16,6 +16,8 @@
 #include <kbuffer.h>
 #include <pthread.h>
 
+#include <linux/limits.h>
+
 #include <sys/mount.h>
 #include <sys/syscall.h>
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] utest/tracefs-utest: define _LARGEFILE64_SOURCE
  2024-02-22 10:12 [PATCH v2 0/3] utest: fix build with musl + clang >=15 Miko Larsson via B4 Relay
  2024-02-22 10:12 ` [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h Miko Larsson via B4 Relay
@ 2024-02-22 10:12 ` Miko Larsson via B4 Relay
  2024-02-22 10:12 ` [PATCH v2 3/3] utest/trace-utest: include libgen.h Miko Larsson via B4 Relay
  2 siblings, 0 replies; 7+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-22 10:12 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

From: Miko Larsson <mikoxyzzz@gmail.com>

This fixes the build with musl + clang >=15; musl doesn't declare
lseek64() otherwise, and clang >=15 doesn't allow implicit declarations.

Fixes: 0f45e68cb04a ("libtracefs: Add unit tests for tracefs_cpu functions")
Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
---
 utest/tracefs-utest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 70bcf3e..224903b 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -3,6 +3,8 @@
  * Copyright (C) 2020, VMware, Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
  *
  */
+#define _LARGEFILE64_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] utest/trace-utest: include libgen.h
  2024-02-22 10:12 [PATCH v2 0/3] utest: fix build with musl + clang >=15 Miko Larsson via B4 Relay
  2024-02-22 10:12 ` [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h Miko Larsson via B4 Relay
  2024-02-22 10:12 ` [PATCH v2 2/3] utest/tracefs-utest: define _LARGEFILE64_SOURCE Miko Larsson via B4 Relay
@ 2024-02-22 10:12 ` Miko Larsson via B4 Relay
  2 siblings, 0 replies; 7+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-22 10:12 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

From: Miko Larsson <mikoxyzzz@gmail.com>

This fixes the build with musl + clang >=15; musl doesn't declare
basename() anywhere else, and clang >=15 doesn't allow implicit
declarations.

Fixes: 845f16976929 ("libtracefs: Add unit tests")
Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
---
 utest/trace-utest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utest/trace-utest.c b/utest/trace-utest.c
index 58d4d4e..39485a1 100644
--- a/utest/trace-utest.c
+++ b/utest/trace-utest.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2020, VMware, Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
  *
  */
+#include <libgen.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <getopt.h>

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h
  2024-02-22 10:12 ` [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h Miko Larsson via B4 Relay
@ 2024-02-22 14:53   ` Steven Rostedt
  2024-02-22 16:04     ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2024-02-22 14:53 UTC (permalink / raw)
  To: Miko Larsson via B4 Relay; +Cc: mikoxyzzz, linux-trace-devel

On Thu, 22 Feb 2024 11:12:44 +0100
Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@kernel.org> wrote:

> From: Miko Larsson <mikoxyzzz@gmail.com>
> 
> This fixes the build with musl + clang >=15; musl doesn't define
> PATH_MAX anywhere else, and clang >=15 doesn't allow implicit
> declarations with >=c99. Without this, the build fails due to PATH_MAX
> not being defined.
> 
> We could include limits.h from the libc, but AFAIK the libc doesn't
> necessarily have to define PATH_MAX, so it's safer to just include
> linux/limits.h

Actually, the way I handle PATH_MAX is to add:

#ifndef PATH_MAX
#define PATH_MAX 1024
#endif

As it's not really used, but just a default value to be able to add any
paths used in the tracefs directory, where 1024 is more than enough.

-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h
  2024-02-22 14:53   ` Steven Rostedt
@ 2024-02-22 16:04     ` Steven Rostedt
  2024-02-22 17:24       ` Miko Larsson
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2024-02-22 16:04 UTC (permalink / raw)
  To: Miko Larsson via B4 Relay; +Cc: mikoxyzzz, linux-trace-devel

On Thu, 22 Feb 2024 09:53:45 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Thu, 22 Feb 2024 11:12:44 +0100
> Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@kernel.org> wrote:
> 
> > From: Miko Larsson <mikoxyzzz@gmail.com>
> > 
> > This fixes the build with musl + clang >=15; musl doesn't define
> > PATH_MAX anywhere else, and clang >=15 doesn't allow implicit
> > declarations with >=c99. Without this, the build fails due to PATH_MAX
> > not being defined.
> > 
> > We could include limits.h from the libc, but AFAIK the libc doesn't
> > necessarily have to define PATH_MAX, so it's safer to just include
> > linux/limits.h  
> 
> Actually, the way I handle PATH_MAX is to add:
> 
> #ifndef PATH_MAX
> #define PATH_MAX 1024
> #endif
> 
> As it's not really used, but just a default value to be able to add any
> paths used in the tracefs directory, where 1024 is more than enough.

I'm going to apply your other two patches, but I created a patch with the
added code above, and will be posting that shortly.

-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h
  2024-02-22 16:04     ` Steven Rostedt
@ 2024-02-22 17:24       ` Miko Larsson
  0 siblings, 0 replies; 7+ messages in thread
From: Miko Larsson @ 2024-02-22 17:24 UTC (permalink / raw)
  To: Steven Rostedt, Miko Larsson via B4 Relay; +Cc: linux-trace-devel

On Thu Feb 22, 2024 at 5:04 PM CET, Steven Rostedt wrote:
> I'm going to apply your other two patches, but I created a patch with the
> added code above, and will be posting that shortly.
Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-22 17:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 10:12 [PATCH v2 0/3] utest: fix build with musl + clang >=15 Miko Larsson via B4 Relay
2024-02-22 10:12 ` [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h Miko Larsson via B4 Relay
2024-02-22 14:53   ` Steven Rostedt
2024-02-22 16:04     ` Steven Rostedt
2024-02-22 17:24       ` Miko Larsson
2024-02-22 10:12 ` [PATCH v2 2/3] utest/tracefs-utest: define _LARGEFILE64_SOURCE Miko Larsson via B4 Relay
2024-02-22 10:12 ` [PATCH v2 3/3] utest/trace-utest: include libgen.h Miko Larsson via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).