Ver Fonte

* interpret -daaa:=bbb after -Sm was passed as a macro definition, resolves #27529

git-svn-id: trunk@30271 -
florian há 10 anos atrás
pai
commit
3396e2e1f4
3 ficheiros alterados com 24 adições e 1 exclusões
  1. 1 0
      .gitattributes
  2. 6 1
      compiler/options.pas
  3. 17 0
      tests/webtbs/tw27529.pp

+ 1 - 0
.gitattributes

@@ -14330,6 +14330,7 @@ tests/webtbs/tw2738.pp svneol=native#text/plain
 tests/webtbs/tw2739.pp svneol=native#text/plain
 tests/webtbs/tw27424.pp svneol=native#text/pascal
 tests/webtbs/tw27515.pp svneol=native#text/pascal
+tests/webtbs/tw27529.pp svneol=native#text/pascal
 tests/webtbs/tw2758.pp svneol=native#text/plain
 tests/webtbs/tw2763.pp svneol=native#text/plain
 tests/webtbs/tw27634.pp svneol=native#text/plain

+ 6 - 1
compiler/options.pas

@@ -1349,7 +1349,12 @@ begin
                    StopOptions(1);
                  end;
                if l>0 then
-                 set_system_compvar(hs,Copy(more,l+2,255))
+                 begin
+                   if cs_support_macro in init_settings.moduleswitches then
+                     set_system_macro(hs,Copy(more,l+2,255))
+                   else
+                     set_system_compvar(hs,Copy(more,l+2,255));
+                 end
                else
                  def_system_macro(hs);
              end;

+ 17 - 0
tests/webtbs/tw27529.pp

@@ -0,0 +1,17 @@
+{ %OPT=-Sm -dMY_VAR:=123 }
+program test;
+
+{$IF DEFINED(MY_VAR)}
+  {$INFO MY_VAR defined}
+  {$IF MY_VAR=123}
+    {$INFO MY_VAR = 123}
+  {$ELSE}
+    {$INFO MY_VAR <> 123}
+  {$ENDIF}
+{$ENDIF}
+
+begin
+  writeln(MY_VAR);
+  if MY_VAR<>123 then
+    halt(1);
+end.