Yeah but that's a compile time constant. Wouldn't get executed at all.
The rules for compile time evaluation are the same as runtime, so it's UB in both cases. The UB may resolve differently but isn't required to.
Preprocessor constant expressions are evaluated with at least the range of the largest integer type available at run time. The C standard requires that "long" have at least 32 bits. So a shift right by 30 in a preprocessor constant expression looks good to me.
Aren't you talking about how expressions are evaluated in #if there? An expression form that shows up in a macro that is then embedded in normal C code just becomes part of the C code that could potentially get evaluated with C rules at compile time; it's not inherently evaluated at preprocessor time.
I am, yes! Thanks for the correction! I thought it was an #if expression, but it presumably isn't. (You can expand arbitrary macros in an #if expression, but it's not often done.)