Selaa lähdekoodia

* flush pending local switch changes before evaluating ifopt
(mantis #10350)

git-svn-id: trunk@9413 -

Jonas Maebe 17 vuotta sitten
vanhempi
commit
24f8249f36
3 muutettua tiedostoa jossa 21 lisäystä ja 0 poistoa
  1. 1 0
      .gitattributes
  2. 5 0
      compiler/scanner.pas
  3. 15 0
      tests/webtbs/tw10350.pp

+ 1 - 0
.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

+ 5 - 0
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;
 

+ 15 - 0
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.