diff mbox series

[1/3] utest/tracefs-utest: add missing include

Message ID 20240215-utest-fixes-v1-1-24678d859de2@gmail.com (mailing list archive)
State Superseded
Headers show
Series utest: fix FTBFS with clang >=15 | expand

Commit Message

Miko Larsson via B4 Relay Feb. 15, 2024, 9:02 a.m. UTC
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(+)

Comments

Steven Rostedt Feb. 21, 2024, 11:48 p.m. UTC | #1
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>
>  
>
Miko Larsson Feb. 22, 2024, 8:57 a.m. UTC | #2
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.
diff mbox series

Patch

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>