Add support for {$PUSHOPT}, {$POPOPT} and long {$IFOPT} names - #470
Open
Bazooper-blip wants to merge 1 commit into
Open
Bazooper-blip wants to merge 1 commit into
Bazooper-blip wants to merge 1 commit into
Conversation
Delphi 13 introduces the `{$PUSHOPT}` and `{$POPOPT}` directives, which
save and restore the current compiler options, and allows long switch
names in `{$IFOPT}` (e.g. `{$IFOPT RANGECHECKS ON}`).
`CompilerSwitchRegistry` now keeps a stack of the active switches. On
`{$POPOPT}`, the currently active switches end at the directive, and
the switches saved by the matching `{$PUSHOPT}` become active again
from that point.
Closes integrated-application-development#411, closes integrated-application-development#412
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for the
{$PUSHOPT}and{$POPOPT}directives and for long switch names in{$IFOPT}, both introduced in Delphi 13.{$PUSHOPT}saves the set of active compiler switches inCompilerSwitchRegistry, and{$POPOPT}restores it: switches that are active at the{$POPOPT}end there, and the saved switches become active again from that point. A{$POPOPT}without a matching{$PUSHOPT}is ignored. As described in #411,PUSHOPTandPOPOPTare added toParameterDirective.ParameterKind.{$IFOPT}now also accepts long switch names with anON/OFFvalue, such as{$IFOPT RANGECHECKS ON}, alongside the existing{$IFOPT R+}form.{$PUSHOPT}and{$POPOPT}also save and restore warning settings, but the preprocessor doesn't track{$WARN}state, so only compiler switches are covered here.I noticed #412 is assigned to @jgardn3r, so I'm happy to drop the
{$IFOPT}part if it's already in progress.Fixes #411, fixes #412.