Control: severity -1 wishlist [...] > I'm not sure if you can use #ifdef with #elif. I've always avoided doing > so, but have to admit having not looked it up in the C standard. >
Just for the record, here's what it says: "Preprocessing directives of the forms #ifdef identifier new-line groupopt #ifndef identifier new-line groupopt check whether the identifier is or is not currently defined as a macro name. Their conditions are equivalent to #if defined identifier and #if !defined identifier respectively." So, yes, mixing #ifdef with #elif is fine. But using #if defined(...) will definitively remove any doubts. > I generally agree with you that it would be better to write -Wundef-clean > code, but a lot of examples from, say, Autoconf are not -Wundef-clean, so > I suspect there's a lot of this out there. And since behavior of an > undefined variable in preprocessor directives is well-defined by the > standard, you'll probably get pushback against making it a rule. > Yes, indeed, this case is explicitly covered. So maybe the rule should rather be "use -Wundef with your own header files only." I've adjusted the severity to wishlist, but feel free to tag it wontfix. Best, Michael
pgp_yG7O4qlFn.pgp
Description: PGP signature