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

Clang 15 onwards defaults to -Werror=implicit-function-declaration,
which breaks the utest build. This series fixes that by simply adding
the missing include and define directives.

Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
---
Miko Larsson (3):
      utest/tracefs-utest: add missing include
      utest/tracefs-utest: add missing define
      utest/trace-utest: add missing include

 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] 8+ messages in thread

* [PATCH 1/3] utest/tracefs-utest: add missing include
  2024-02-15  9:02 [PATCH 0/3] utest: fix FTBFS with clang >=15 Miko Larsson via B4 Relay
@ 2024-02-15  9:02 ` Miko Larsson via B4 Relay
  2024-02-21 23:48   ` Steven Rostedt
  2024-02-15  9:02 ` [PATCH 2/3] utest/tracefs-utest: add missing define Miko Larsson via B4 Relay
  2024-02-15  9:02 ` [PATCH 3/3] utest/trace-utest: add missing include Miko Larsson via B4 Relay
  2 siblings, 1 reply; 8+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-15  9:02 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

From: Miko Larsson <mikoxyzzz@gmail.com>

Fixes FTBFS with clang >=15

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..a798ace 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -19,6 +19,8 @@
 #include <sys/mount.h>
 #include <sys/syscall.h>
 
+#include <linux/limits.h>
+
 #include <CUnit/CUnit.h>
 #include <CUnit/Basic.h>
 

-- 
2.43.0


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

* [PATCH 2/3] utest/tracefs-utest: add missing define
  2024-02-15  9:02 [PATCH 0/3] utest: fix FTBFS with clang >=15 Miko Larsson via B4 Relay
  2024-02-15  9:02 ` [PATCH 1/3] utest/tracefs-utest: add missing include Miko Larsson via B4 Relay
@ 2024-02-15  9:02 ` Miko Larsson via B4 Relay
  2024-02-21 23:49   ` Steven Rostedt
  2024-02-15  9:02 ` [PATCH 3/3] utest/trace-utest: add missing include Miko Larsson via B4 Relay
  2 siblings, 1 reply; 8+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-15  9:02 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

From: Miko Larsson <mikoxyzzz@gmail.com>

Fixes FTBFS with clang >=15

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 a798ace..e30e8e7 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] 8+ messages in thread

* [PATCH 3/3] utest/trace-utest: add missing include
  2024-02-15  9:02 [PATCH 0/3] utest: fix FTBFS with clang >=15 Miko Larsson via B4 Relay
  2024-02-15  9:02 ` [PATCH 1/3] utest/tracefs-utest: add missing include Miko Larsson via B4 Relay
  2024-02-15  9:02 ` [PATCH 2/3] utest/tracefs-utest: add missing define Miko Larsson via B4 Relay
@ 2024-02-15  9:02 ` Miko Larsson via B4 Relay
  2 siblings, 0 replies; 8+ messages in thread
From: Miko Larsson via B4 Relay @ 2024-02-15  9:02 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Miko Larsson

From: Miko Larsson <mikoxyzzz@gmail.com>

Fixes FTBFS with clang >=15

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] 8+ messages in thread

* Re: [PATCH 1/3] utest/tracefs-utest: add missing include
  2024-02-15  9:02 ` [PATCH 1/3] utest/tracefs-utest: add missing include Miko Larsson via B4 Relay
@ 2024-02-21 23:48   ` Steven Rostedt
  2024-02-22  8:57     ` Miko Larsson
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2024-02-21 23:48 UTC (permalink / raw)
  To: Miko Larsson via B4 Relay; +Cc: mikoxyzzz, linux-trace-devel

On Thu, 15 Feb 2024 10:02:41 +0100
Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@kernel.org> wrote:

> From: Miko Larsson <mikoxyzzz@gmail.com>

Hi Miko,

> 
> Fixes FTBFS with clang >=15

What exactly is this fixing. I tried building the tests with clang 16 and I
don't get any errors. Please show the error that you have without this
change.

-- Steve

 
> 
> 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..a798ace 100644
> --- a/utest/tracefs-utest.c
> +++ b/utest/tracefs-utest.c
> @@ -19,6 +19,8 @@
>  #include <sys/mount.h>
>  #include <sys/syscall.h>
>  
> +#include <linux/limits.h>
> +
>  #include <CUnit/CUnit.h>
>  #include <CUnit/Basic.h>
>  
> 


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

* Re: [PATCH 2/3] utest/tracefs-utest: add missing define
  2024-02-15  9:02 ` [PATCH 2/3] utest/tracefs-utest: add missing define Miko Larsson via B4 Relay
@ 2024-02-21 23:49   ` Steven Rostedt
  2024-02-22  8:59     ` Miko Larsson
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2024-02-21 23:49 UTC (permalink / raw)
  To: Miko Larsson via B4 Relay; +Cc: mikoxyzzz, linux-trace-devel

On Thu, 15 Feb 2024 10:02:42 +0100
Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@kernel.org> wrote:

> From: Miko Larsson <mikoxyzzz@gmail.com>
> 
> Fixes FTBFS with clang >=15

FTBFS is a rather useless explanation (and I had to even look it up to find
out what it is ;-)

The change log should show the error and explain why the change fixes the
problem.

Thanks,

-- Steve


> 
> 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 a798ace..e30e8e7 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>
> 


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

* Re: [PATCH 1/3] utest/tracefs-utest: add missing include
  2024-02-21 23:48   ` Steven Rostedt
@ 2024-02-22  8:57     ` Miko Larsson
  0 siblings, 0 replies; 8+ messages in thread
From: Miko Larsson @ 2024-02-22  8:57 UTC (permalink / raw)
  To: Steven Rostedt, Miko Larsson via B4 Relay; +Cc: linux-trace-devel

On Thu Feb 22, 2024 at 12:48 AM CET, Steven Rostedt wrote:
> What exactly is this fixing. I tried building the tests with clang 16 and I
> don't get any errors. Please show the error that you have without this
> change.
Hm, yeah, could be that this occurs with clang >16, not sure though.

Following is the error I get with clang 18 without this patch applied:
FAILED: utest/trace-utest.p/tracefs-utest.c.o 
clang -Iutest/trace-utest.p -Iutest -I../utest -Iinclude -I../include -I/usr/include/traceevent -flto=thin -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -Wformat -Werror=format-security -ftrivial-auto-var-init=zero -fstack-clash-protection -fsanitize=signed-integer-overflow,integer-divide-by-zero -fsanitize-trap=signed-integer-overflow,integer-divide-by-zero -fno-sanitize-recover -flto=thin -O2 -ffile-prefix-map=/builddir/libtracefs-1.8.0=. -g2 -pthread -MD -MQ utest/trace-utest.p/tracefs-utest.c.o -MF utest/trace-utest.p/tracefs-utest.c.o.d -o utest/trace-utest.p/tracefs-utest.c.o -c ../utest/tracefs-utest.c
../utest/tracefs-utest.c:2494:12: error: use of undeclared identifier 'PATH_MAX'
 2494 |         char self[PATH_MAX] = { 0 };
      |                   ^
../utest/tracefs-utest.c:2850:12: error: use of undeclared identifier 'PATH_MAX'
 2850 |         char link[PATH_MAX + 1];
      |                   ^
../utest/tracefs-utest.c:2851:12: error: use of undeclared identifier 'PATH_MAX'
 2851 |         char path[PATH_MAX + 1];
      |                   ^
../utest/tracefs-utest.c:2856:17: error: use of undeclared identifier 'PATH_MAX'
 2856 |         snprintf(link, PATH_MAX, "/proc/self/fd/%d", fd);
      |                        ^
../utest/tracefs-utest.c:2864:29: error: use of undeclared identifier 'PATH_MAX'
 2864 |         ret = readlink(link, path, PATH_MAX);
      |                                    ^
../utest/tracefs-utest.c:2866:12: error: use of undeclared identifier 'PATH_MAX'
 2866 |         if (ret > PATH_MAX || ret < 0)
      |                   ^
../utest/tracefs-utest.c:2887:12: error: use of undeclared identifier 'PATH_MAX'
 2887 |         char path[PATH_MAX + 1];
      |                   ^
../utest/tracefs-utest.c:2896:17: error: use of undeclared identifier 'PATH_MAX'
 2896 |         snprintf(path, PATH_MAX, "/proc/self/fdinfo/%d", fd);
      |                        ^
../utest/tracefs-utest.c:3028:12: error: use of undeclared identifier 'PATH_MAX'
 3028 |         char file[PATH_MAX];
      |                   ^
../utest/tracefs-utest.c:3043:17: error: use of undeclared identifier 'PATH_MAX'
 3043 |         snprintf(file, PATH_MAX, "options/%s", name);
      |                        ^
../utest/tracefs-utest.c:3092:12: error: use of undeclared identifier 'PATH_MAX'
 3092 |         char file[PATH_MAX];
      |                   ^
../utest/tracefs-utest.c:3112:18: error: use of undeclared identifier 'PATH_MAX'
 3112 |                 snprintf(file, PATH_MAX, "options/%s", name);
      |                                ^
../utest/tracefs-utest.c:3256:12: error: use of undeclared identifier 'PATH_MAX'
 3256 |         char file[PATH_MAX];
      |                   ^
../utest/tracefs-utest.c:3460:12: error: use of undeclared identifier 'PATH_MAX'
 3460 |         char path[PATH_MAX];
      |                   ^
../utest/tracefs-utest.c:3480:17: error: use of undeclared identifier 'PATH_MAX'
 3480 |         char file_from[PATH_MAX];
      |                        ^
../utest/tracefs-utest.c:3481:15: error: use of undeclared identifier 'PATH_MAX'
 3481 |         char file_to[PATH_MAX];
      |                      ^
../utest/tracefs-utest.c:3493:17: error: use of undeclared identifier 'PATH_MAX'
 3493 |         char file_from[PATH_MAX];
      |                        ^
../utest/tracefs-utest.c:3494:15: error: use of undeclared identifier 'PATH_MAX'
 3494 |         char file_to[PATH_MAX];
      |                      ^
18 errors generated.

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

* Re: [PATCH 2/3] utest/tracefs-utest: add missing define
  2024-02-21 23:49   ` Steven Rostedt
@ 2024-02-22  8:59     ` Miko Larsson
  0 siblings, 0 replies; 8+ messages in thread
From: Miko Larsson @ 2024-02-22  8:59 UTC (permalink / raw)
  To: Steven Rostedt, Miko Larsson via B4 Relay; +Cc: linux-trace-devel

On Thu Feb 22, 2024 at 12:49 AM CET, Steven Rostedt wrote:
> FTBFS is a rather useless explanation (and I had to even look it up to find
> out what it is ;-)
>
> The change log should show the error and explain why the change fixes the
> problem.
Heh, yeah, you're right. Thanks.

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15  9:02 [PATCH 0/3] utest: fix FTBFS with clang >=15 Miko Larsson via B4 Relay
2024-02-15  9:02 ` [PATCH 1/3] utest/tracefs-utest: add missing include Miko Larsson via B4 Relay
2024-02-21 23:48   ` Steven Rostedt
2024-02-22  8:57     ` Miko Larsson
2024-02-15  9:02 ` [PATCH 2/3] utest/tracefs-utest: add missing define Miko Larsson via B4 Relay
2024-02-21 23:49   ` Steven Rostedt
2024-02-22  8:59     ` Miko Larsson
2024-02-15  9:02 ` [PATCH 3/3] utest/trace-utest: add missing include 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).