瀏覽代碼

* support for -WM10.XX (for 10.10) and defining the correct associated
version macro

git-svn-id: trunk@30178 -

Jonas Maebe 10 年之前
父節點
當前提交
d4bc74ecc0
共有 1 個文件被更改,包括 16 次插入6 次删除
  1. 16 6
      compiler/options.pas

+ 16 - 6
compiler/options.pas

@@ -815,6 +815,7 @@ function toption.ParseMacVersionMin(out minstr, emptystr: string; const compvarn
     temp,
     temp,
     compvarvalue: string[15];
     compvarvalue: string[15];
     i: longint;
     i: longint;
+    osx_minor_two_digits: boolean;
   begin
   begin
     minstr:=value;
     minstr:=value;
     emptystr:='';
     emptystr:='';
@@ -838,11 +839,16 @@ function toption.ParseMacVersionMin(out minstr, emptystr: string; const compvarn
     temp:=subval(i+1,2,i);
     temp:=subval(i+1,2,i);
     if temp='' then
     if temp='' then
       exit(false);
       exit(false);
-    { on Mac OS X, the minor version number is limited to 1 digit }
+    { on Mac OS X, the minor version number was originally limited to 1 digit;
+      with 10.10 the format changed and two digits were also supported; on iOS,
+      the minor version number always takes up two digits }
+    osx_minor_two_digits:=false;
     if not ios then
     if not ios then
       begin
       begin
-        if length(temp)<>1 then
-          exit(false);
+        { if the minor version number is two digits on OS X (the case since
+          OS X 10.10), we also have to add two digits for the patch level}
+        if length(temp)=2 then
+          osx_minor_two_digits:=true;
       end
       end
     { the minor version number always takes up two digits on iOS }
     { the minor version number always takes up two digits on iOS }
     else if length(temp)=1 then
     else if length(temp)=1 then
@@ -859,9 +865,12 @@ function toption.ParseMacVersionMin(out minstr, emptystr: string; const compvarn
         { there's only room for a single digit patch level in the version macro
         { there's only room for a single digit patch level in the version macro
           for Mac OS X. gcc sets it to zero if there are more digits, but that
           for Mac OS X. gcc sets it to zero if there are more digits, but that
           seems worse than clamping to 9 (don't declare as invalid like with
           seems worse than clamping to 9 (don't declare as invalid like with
-          minor version number, because there is a precedent like 10.4.11)
+          minor version number, because there is a precedent like 10.4.11).
+
+          As of OS X 10.10 there are two digits for the patch level
         }
         }
-        if not ios then
+        if not ios and
+           not osx_minor_two_digits then
           begin
           begin
             if length(temp)<>1 then
             if length(temp)<>1 then
               temp:='9';
               temp:='9';
@@ -877,7 +886,8 @@ function toption.ParseMacVersionMin(out minstr, emptystr: string; const compvarn
         if i<=length(value) then
         if i<=length(value) then
           exit(false);
           exit(false);
       end
       end
-    else if not ios then
+    else if not ios and
+       not osx_minor_two_digits then
       compvarvalue:=compvarvalue+'0'
       compvarvalue:=compvarvalue+'0'
     else
     else
       compvarvalue:=compvarvalue+'00';
       compvarvalue:=compvarvalue+'00';