CALL_ARGS(9)
π CALL_ARGS(9) β like, the Kernel API Manual, bestie
okay so this one lives in the Kernel API Manual and it's genuinely one of those little macro gremlins that makes the preprocessor behave. stick with me, it's cute once you get it π«Ά
β¨ NAME β¨
CALL_ARGS β invoke a macro, but let its parameters get expanded before the call happens. yes, that's the whole vibe. no cap.
πΈ SYNOPSIS πΈ
CALL_ARGS (f , args... );
π ARGUMENTS π
fβ the name of the macro you wanna invoke. just the name, babe, not the whole call.argsβ the arguments you're feeding to that macro.
π¦ DESCRIPTION π¦
so here's the tea β β this macro is for calling macros whose names might be generated on the fly, or when you just really need to make sure the arguments get correctly expanded first. it's giving "trust the process, but verify the expansion" energy. periodt.
π EXAMPLE π
#define foo X,Y,Z,Q
#define bar COUNT_ARGS(foo)
#define buz CALL_ARGS(COUNT_ARGS, foo)
with the definitions above, bar expands to 1 while buz expands to 4. and that difference? iconic. that's literally the whole point β CALL_ARGS expands foo into X,Y,Z,Q first, so COUNT_ARGS actually sees four args instead of one lump. slay π
π SEE ALSO π
- kernel file
./drivers/gpu/drm/xe/xe_args.hβ go read it, iykyk π DROP_FIRST_ARG(9)FIRST_ARG(9)LAST_ARG(9)PICK_ARG(9)IF_ARGS(9)ARGS_SEP_COMMA(9)
all the arg-macro girlies, a whole friend group fr fr π
ngl bestie, these are preprocessor macros β the details of expansion order matter a lot, so don't be out here guessing. read the header, run it, confirm it. π₯
and that's the page!! shipped from ./drivers/gpu/drm/xe, dated October 2026, and it ate, no crumbs left. mwah πΈβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms