On Wed, Jul 16, 2025 at 10:42:58PM +0000, Carlos Llamas wrote: > On Wed, Jul 16, 2025 at 03:28:49PM -0700, Tiffany Yang wrote: > > Kees Cook <k...@kernel.org> writes: > > > > > > ... > > > > > I'm used to the "#ifdef CONFIG_..." idiom, but looking at the tree, I > > > see that "#if IS_ENANLED(CONFIG...)" is relatively common too. I don't > > > think there is a function difference, so I leave the style choice up to > > > you! ;) > > > > > > IIRC, I had tried using the #ifdef to inject test-specific code in some > > places, but that created issues when we were loading KUnit as a module > > because it causes the built-in code to be built as though the > > "CONFIG_..." is undefined. Consequently, I started using IS_ENABLED by > > default, but I'm not sure if it's strictly necessary for exposing > > functions with a header file since I'd assume "CONFIG_..." will be > > defined when we're building the module? > > Right, IS_ENABLED() is the "short-hand" for ... > #if defined(CONFIG_x) || defined(CONFIG_x_MODULE) > ... which is what we need here.
Ah-ha! Okay, thanks for the explanation. I don't do much module work, it seems. ;) -- Kees Cook