On Sat, 2 May 2026 00:17:50 +0800
Qian-Yu Lin <[email protected]> wrote:
> Yes, I verified it with the preprocessor output. I created a minimal
> test file:
>
> // kernel/trace/test_trace_printk.c
> #include <linux/trace_printk.h>
>
> void test(void) {
> trace_printk("no args\n");
> trace_printk("with arg %d\n", 42);
> }
>
> Then ran make kernel/trace/test_trace_printk.i.
>
> The no-args case has sizeof((char[]){"()"}) which is 3, so 3 > 3 is
> false and it falls through to trace_bputs/trace_puts.
>
> The args case has sizeof((char[]){"(42)"}) which is 5, so 5 > 3 is
> true and it goes to trace_bprintk/trace_printk with the argument
> 42 correctly passed through.
Thanks. When I test, I do the same but just compile down to an object file
and run objdump and look at which functions were called.
-- Steve