CALL_ARGS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 🌈

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