Explorar o código

+ $pushopt/$popopt, resolves #41538

florian hai 1 día
pai
achega
60e27781ed
Modificáronse 2 ficheiros con 22 adicións e 0 borrados
  1. 2 0
      compiler/scandir.pas
  2. 20 0
      tests/test/tpushpop4.pp

+ 2 - 0
compiler/scandir.pas

@@ -2291,8 +2291,10 @@ unit scandir;
         AddDirective('PIC',directive_all, @dir_pic);
         AddDirective('POINTERMATH',directive_all, @dir_pointermath);
         AddDirective('POP',directive_all, @dir_pop);
+        AddDirective('POPOPT',directive_all, @dir_pop);
         AddDirective('PROFILE',directive_all, @dir_profile);
         AddDirective('PUSH',directive_all, @dir_push);
+        AddDirective('PUSHOPT',directive_all, @dir_push);
         AddDirective('R',directive_all, @dir_resource);
         AddDirective('RTTI',directive_all, @dir_rtti);
         AddDirective('RANGECHECKS',directive_all, @dir_rangechecks);

+ 20 - 0
tests/test/tpushpop4.pp

@@ -0,0 +1,20 @@
+program tpushpop1;
+
+type
+{$MinEnumSize 1}
+  TTest1 = (t1One, t1Two, t1Three);
+{$pushopt}
+{$MinEnumSize 2}
+  TTest2 = (t2One, t2Two, t2Three);
+{$popopt}
+  TTest3 = (t3One, t3Two, t3Three);
+
+begin
+  if SizeOf(TTest1) <> 1 then
+    Halt(1);
+  if SizeOf(TTest2) <> 2 then
+    Halt(2);
+  if SizeOf(TTest3) <> 1 then
+    Halt(3);
+  Writeln('ok');
+end.