On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar <tony.ambardar@xxxxxxxxx> wrote: > > From: Tony Ambardar <tony.ambardar@xxxxxxxxx> > > Typically stdin, stdout, stderr are treated as reserved identifiers under > ISO/ANSI C, and a libc implementation is free to define these as macros. Ok, wow that. Do you have a pointer to where in the standard it is said that stdin/stdout/stderr is some sort of reserved identifier that can't be used as a field name? I really don't like these underscored field names. If we have to rename, I'd prefer something like env.saved_stdout instead of env._stdout. But I'd prefer even more if musl wasn't doing this macro definition, of course... > This is the case in musl libc and results in compile errors when these > names are reused as struct fields, as with 'struct test_env' and related > usage in test_progs.[ch] and reg_bounds.c. > > Rename the fields to _stdout and _stderr to avoid many errors seen building > against musl, e.g.: > > In file included from test_progs.h:6, > from test_progs.c:5: > test_progs.c: In function 'print_test_result': > test_progs.c:237:21: error: expected identifier before '(' token > 237 | fprintf(env.stdout, "#%-*d %s:", TEST_NUM_WIDTH, test->test_num, test->test_name); > | ^~~~~~ > test_progs.c:237:9: error: too few arguments to function 'fprintf' > 237 | fprintf(env.stdout, "#%-*d %s:", TEST_NUM_WIDTH, test->test_num, test->test_name); > | ^~~~~~~ > > Signed-off-by: Tony Ambardar <tony.ambardar@xxxxxxxxx> > --- > .../selftests/bpf/prog_tests/reg_bounds.c | 2 +- > tools/testing/selftests/bpf/test_progs.c | 66 +++++++++---------- > tools/testing/selftests/bpf/test_progs.h | 8 +-- > 3 files changed, 38 insertions(+), 38 deletions(-) > [...]