Re: [PATCH bpf-next] selftests/bpf: allow veristat compile standalone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 2, 2025 at 7:27 AM Mykyta Yatsenko
<mykyta.yatsenko5@xxxxxxxxx> wrote:
>
> From: Mykyta Yatsenko <yatsenko@xxxxxxxx>
>
> Veristat is synced into the standalone repo, where it compiles without
> kernel private dependencies. This patch fixes compilation errors in
> standalone veristat.
>
> Signed-off-by: Mykyta Yatsenko <yatsenko@xxxxxxxx>
> ---
>  tools/testing/selftests/bpf/veristat.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
> index 09cfbd486f92..4b79f00b0a9c 100644
> --- a/tools/testing/selftests/bpf/veristat.c
> +++ b/tools/testing/selftests/bpf/veristat.c
> @@ -23,6 +23,7 @@
>  #include <float.h>
>  #include <math.h>
>  #include <limits.h>
> +#include <assert.h>
>
>  #ifndef ARRAY_SIZE
>  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
> @@ -239,6 +240,14 @@ static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va
>
>  #define log_errno(fmt, ...) log_errno_aux(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
>
> +#ifndef __printf
> +#define __printf(a, b) __attribute__((format(printf, a, b)))
> +#endif
> +
> +#ifndef __scanf
> +#define __scanf(a, b)  __attribute__((format(scanf, a, b)))
> +#endif
> +

let's maybe just use __attribute__ directly instead of __printf and
__scanf, to rely less on kernel-internal convenience macros (instead
of redefining them)?

pw-bot: cr


>  __printf(3, 4)
>  static int log_errno_aux(const char *file, int line, const char *fmt, ...)
>  {
> --
> 2.50.0
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux