From 24f8249f36407faec8df76eaf4a4929a8a3bf395 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 7 Dec 2007 18:24:57 +0000 Subject: [PATCH] * flush pending local switch changes before evaluating ifopt (mantis #10350) git-svn-id: trunk@9413 - --- .gitattributes | 1 + compiler/scanner.pas | 5 +++++ tests/webtbs/tw10350.pp | 15 +++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/webtbs/tw10350.pp diff --git a/.gitattributes b/.gitattributes index ee0ef7993b..6d18191409 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7799,6 +7799,7 @@ tests/webtbs/tw10210.pp svneol=native#text/plain tests/webtbs/tw10224.pp svneol=native#text/plain tests/webtbs/tw1023.pp svneol=native#text/plain tests/webtbs/tw10320.pp svneol=native#text/plain +tests/webtbs/tw10350.pp svneol=native#text/plain tests/webtbs/tw10371.pp svneol=native#text/plain tests/webtbs/tw1041.pp svneol=native#text/plain tests/webtbs/tw1044.pp svneol=native#text/plain diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 7167a785e4..2bfe4e4c66 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -487,6 +487,11 @@ implementation procedure dir_ifopt; begin + if localswitcheschanged then + begin + current_settings.localswitches:=nextlocalswitches; + localswitcheschanged:=false; + end; current_scanner.ifpreprocstack(pp_ifopt,@opt_check,scan_c_ifopt_found); end; diff --git a/tests/webtbs/tw10350.pp b/tests/webtbs/tw10350.pp new file mode 100644 index 0000000000..b8d3f51453 --- /dev/null +++ b/tests/webtbs/tw10350.pp @@ -0,0 +1,15 @@ +{ %norun } + +program TestLocal; +var i: longint; +begin +{$R+} +{$ifopt R+} +{$define local_RangeCheck} +{$R-} +{$endif} + i:= longword( -1); +{$ifdef local_RangeCheck} +{$R+} +{$endif} +end.