浏览代码

+ for TP7 compatibility, allow the '&', '$' and '?' characters in the x86 intel
syntax inline asm reader

git-svn-id: trunk@38167 -

nickysn 7 年之前
父节点
当前提交
391f85f828
共有 3 个文件被更改,包括 28 次插入2 次删除
  1. 1 0
      .gitattributes
  2. 4 2
      compiler/x86/rax86int.pas
  3. 23 0
      tests/test/tuglylabels1.pp

+ 1 - 0
.gitattributes

@@ -13641,6 +13641,7 @@ tests/test/tudots.dot.prog.pp svneol=native#text/pascal
 tests/test/tudots.pp svneol=native#text/pascal
 tests/test/tudots.prog.pp svneol=native#text/pascal
 tests/test/tudots.test.pp svneol=native#text/pascal
+tests/test/tuglylabels1.pp svneol=native#text/plain
 tests/test/tunaligned1.pp svneol=native#text/plain
 tests/test/tunistr1.pp svneol=native#text/plain
 tests/test/tunistr2.pp svneol=native#text/plain

+ 4 - 2
compiler/x86/rax86int.pas

@@ -275,7 +275,9 @@ Unit Rax86int;
          begin
            firsttoken:=FALSE;
            len:=0;
-           while c in ['A'..'Z','a'..'z','0'..'9','_','@'] do
+           while (c in ['A'..'Z','a'..'z','0'..'9','_','@']) or
+                 { TP7 also allows $&? characters in local labels }
+                 (forcelabel and (c in ['$','&','?'])) do
             begin
               { if there is an at_sign, then this must absolutely be a label }
               if c = '@' then
@@ -328,7 +330,7 @@ Unit Rax86int;
                begin
                  actasmpattern:=c;
                  c:=current_scanner.asmgetchar;
-                 while c in  ['A'..'Z','a'..'z','0'..'9','_','@'] do
+                 while c in  ['A'..'Z','a'..'z','0'..'9','_','@','$','&','?'] do
                   begin
                     actasmpattern:=actasmpattern + c;
                     c:=current_scanner.asmgetchar;

+ 23 - 0
tests/test/tuglylabels1.pp

@@ -0,0 +1,23 @@
+{ %NORUN }
+{ %CPU=i8086,i386,x86_64 }
+program tuglylabels1;
+
+{ This test is TP7 compatible }
+
+{$ifdef FPC}
+  {$asmmode intel}
+{$endif FPC}
+
+{ allowed characters in a local label:
+  @$&_?abcdefghijklmnopqrstuvwxyz0123456789 }
+
+begin
+  asm
+@:
+    jmp @
+@@:
+    jmp @@
+@$&_?@9:
+    jmp @$&_?@9
+  end;
+end.