AaronBallman wrote: > And contrariwise, if there's some sneaky way to put push/pop pragmas in > non-file contexts, that also seems like a serious problem, because the way we > process them is not designed to understand local scopes, which means we're > just doing random stuff instead of implementing any sort of intelligible > language design.
What if it's a non-sneaky way? ;-) C has several fp-related pragmas that are required to be supported at block scope. For example, the specification for `#pragma STDC FP_CONTRACT` (C23 7.12.2p2) says: > ... Each pragma can occur either outside external declarations or preceding > all explicit declarations and statements inside a compound statement. When > outside external declarations, the pragma takes effect from its occurrence > until another FP_CONTRACT pragma is encountered, or until the end of the > translation unit. When inside a compound statement, the pragma takes effect > from its occurrence until another FP_CONTRACT pragma is encountered > (including within a nested compound statement), or until the end of the > compound statement; at the end of a compound statement the state for the > pragma is restored to its condition just before the compound statement. If > this pragma is used in any other context, the behavior is undefined. ... Other standard pragmas have similar wording. CC @zahiraam who has also been working on pragmas in this area. https://github.com/llvm/llvm-project/pull/70646 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits