瀏覽代碼

+ initial support for pascal booleans with sizes 2, 4 and 8

git-svn-id: branches/pasboolxx@17836 -
florian 14 年之前
父節點
當前提交
d35d1ed357

+ 37 - 2
compiler/dbgdwarf.pas

@@ -1418,8 +1418,7 @@ implementation
                 ]);
               finish_entry;
             end;
-          pasbool,
-          bool8bit :
+          pasbool8 :
             begin
               append_entry(DW_TAG_base_type,false,[
                 DW_AT_name,DW_FORM_string,'Boolean'#0,
@@ -1428,6 +1427,24 @@ implementation
                 ]);
               finish_entry;
             end;
+          bool8bit :
+            begin
+              append_entry(DW_TAG_base_type,false,[
+                DW_AT_name,DW_FORM_string,'ByteBool'#0,
+                DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean,
+                DW_AT_byte_size,DW_FORM_data1,1
+                ]);
+              finish_entry;
+            end;
+          pasbool16 :
+            begin
+              append_entry(DW_TAG_base_type,false,[
+                DW_AT_name,DW_FORM_string,'Boolean16'#0,
+                DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean,
+                DW_AT_byte_size,DW_FORM_data1,2
+                ]);
+              finish_entry;
+            end;
           bool16bit :
             begin
               append_entry(DW_TAG_base_type,false,[
@@ -1437,6 +1454,15 @@ implementation
                 ]);
               finish_entry;
             end;
+          pasbool32 :
+            begin
+              append_entry(DW_TAG_base_type,false,[
+                DW_AT_name,DW_FORM_string,'Boolean32'#0,
+                DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean,
+                DW_AT_byte_size,DW_FORM_data1,4
+                ]);
+              finish_entry;
+            end;
           bool32bit :
             begin
               append_entry(DW_TAG_base_type,false,[
@@ -1446,6 +1472,15 @@ implementation
                 ]);
               finish_entry;
             end;
+          pasbool64 :
+            begin
+              append_entry(DW_TAG_base_type,false,[
+                DW_AT_name,DW_FORM_string,'Boolean64'#0,
+                DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean,
+                DW_AT_byte_size,DW_FORM_data1,8
+                ]);
+              finish_entry;
+            end;
           bool64bit :
             begin
               append_entry(DW_TAG_base_type,false,[

+ 8 - 2
compiler/dbgstabs.pas

@@ -624,7 +624,10 @@ implementation
             case def.ordtype of
               uvoid :
                 ss:=def_stab_number(def);
-              pasbool,
+              pasbool8,
+              pasbool16,
+              pasbool32,
+              pasbool64,
               bool8bit,
               bool16bit,
               bool32bit,
@@ -647,13 +650,16 @@ implementation
                 ss:='-20;';
               uwidechar :
                 ss:='-30;';
-              pasbool,
+              pasbool8,
               bool8bit :
                 ss:='-21;';
+              pasbool16,
               bool16bit :
                 ss:='-22;';
+              pasbool32,
               bool32bit :
                 ss:='-23;';
+              pasbool64,
               bool64bit :
                 { no clue if this is correct (FK) }
                 ss:='-23;';

+ 7 - 4
compiler/defcmp.pas

@@ -166,7 +166,8 @@ implementation
           (bvoid,
            bint,bint,bint,bint,
            bint,bint,bint,bint,
-           bbool,bbool,bbool,bbool,bbool,
+           bbool,bbool,bbool,bbool,
+           bbool,bbool,bbool,bbool,
            bchar,bchar,bint);
 
         basedefconvertsimplicit : array[tbasedef,tbasedef] of tconverttype =
@@ -241,7 +242,8 @@ implementation
                                 end;
                             end;
                           uvoid,
-                          pasbool,bool8bit,bool16bit,bool32bit,bool64bit:
+                          pasbool8,pasbool16,pasbool32,pasbool64,
+                          bool8bit,bool16bit,bool32bit,bool64bit:
                             eq:=te_equal;
                           else
                             internalerror(200210061);
@@ -1551,8 +1553,9 @@ implementation
                 u8bit,u16bit,u32bit,u64bit,
                 s8bit,s16bit,s32bit,s64bit :
                   is_subequal:=(torddef(def2).ordtype in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
-                pasbool,bool8bit,bool16bit,bool32bit,bool64bit :
-                  is_subequal:=(torddef(def2).ordtype in [pasbool,bool8bit,bool16bit,bool32bit,bool64bit]);
+                pasbool8,pasbool16,pasbool32,pasbool64,
+                bool8bit,bool16bit,bool32bit,bool64bit :
+                  is_subequal:=(torddef(def2).ordtype in [pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit]);
                 uchar :
                   is_subequal:=(torddef(def2).ordtype=uchar);
                 uwidechar :

+ 4 - 3
compiler/defutil.pas

@@ -387,7 +387,8 @@ implementation
                is_ordinal:=dt in [uchar,uwidechar,
                                   u8bit,u16bit,u32bit,u64bit,
                                   s8bit,s16bit,s32bit,s64bit,
-                                  pasbool,bool8bit,bool16bit,bool32bit,bool64bit];
+                                  pasbool8,pasbool16,pasbool32,pasbool64,
+                                  bool8bit,bool16bit,bool32bit,bool64bit];
              end;
            enumdef :
              is_ordinal:=true;
@@ -444,14 +445,14 @@ implementation
     function is_boolean(def : tdef) : boolean;
       begin
         result:=(def.typ=orddef) and
-                    (torddef(def).ordtype in [pasbool,bool8bit,bool16bit,bool32bit,bool64bit]);
+                    (torddef(def).ordtype in [pasbool8,pasbool16,pasbool32,pasbool64,bool8bit,bool16bit,bool32bit,bool64bit]);
       end;
 
 
     function is_pasbool(def : tdef) : boolean;
       begin
         result:=(def.typ=orddef) and
-                    (torddef(def).ordtype = pasbool);
+                    (torddef(def).ordtype in [pasbool8,pasbool16,pasbool32,pasbool64]);
       end;
 
     { true if def is a C-style boolean (non-zero value = true, zero = false) }

+ 2 - 1
compiler/htypechk.pas

@@ -2477,7 +2477,8 @@ implementation
         variantorddef_cl: array[tordtype] of tvariantequaltype =
           (tve_incompatible,tve_byte,tve_word,tve_cardinal,tve_chari64,
            tve_shortint,tve_smallint,tve_longint,tve_chari64,
-           tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal,
+           tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal,
+           tve_boolformal,tve_boolformal,tve_boolformal,tve_boolformal,
            tve_chari64,tve_chari64,tve_dblcurrency);
 { TODO: fixme for 128 bit floats }
         variantfloatdef_cl: array[tfloattype] of tvariantequaltype =

+ 54 - 54
compiler/nadd.pas

@@ -334,17 +334,17 @@ implementation
                  else
                    t:=cordconstnode.create(lv and rv,resultdef,true);
                ltn :
-                 t:=cordconstnode.create(ord(lv<rv),booltype,true);
+                 t:=cordconstnode.create(ord(lv<rv),pasbool8type,true);
                lten :
-                 t:=cordconstnode.create(ord(lv<=rv),booltype,true);
+                 t:=cordconstnode.create(ord(lv<=rv),pasbool8type,true);
                gtn :
-                 t:=cordconstnode.create(ord(lv>rv),booltype,true);
+                 t:=cordconstnode.create(ord(lv>rv),pasbool8type,true);
                gten :
-                 t:=cordconstnode.create(ord(lv>=rv),booltype,true);
+                 t:=cordconstnode.create(ord(lv>=rv),pasbool8type,true);
                equaln :
-                 t:=cordconstnode.create(ord(lv=rv),booltype,true);
+                 t:=cordconstnode.create(ord(lv=rv),pasbool8type,true);
                unequaln :
-                 t:=cordconstnode.create(ord(lv<>rv),booltype,true);
+                 t:=cordconstnode.create(ord(lv<>rv),pasbool8type,true);
                slashn :
                  begin
                    { int/int becomes a real }
@@ -387,30 +387,30 @@ implementation
                 case nodetype of
                  ltn:
                    if lv<low then
-                     t:=Cordconstnode.create(1,booltype,true)
+                     t:=Cordconstnode.create(1,pasbool8type,true)
                    else if lv>=high then
-                     t:=Cordconstnode.create(0,booltype,true);
+                     t:=Cordconstnode.create(0,pasbool8type,true);
                  lten:
                    if lv<=low then
-                     t:=Cordconstnode.create(1,booltype,true)
+                     t:=Cordconstnode.create(1,pasbool8type,true)
                    else if lv>high then
-                     t:=Cordconstnode.create(0,booltype,true);
+                     t:=Cordconstnode.create(0,pasbool8type,true);
                  gtn:
                    if lv<=low then
-                     t:=Cordconstnode.create(0,booltype,true)
+                     t:=Cordconstnode.create(0,pasbool8type,true)
                    else if lv>high then
-                     t:=Cordconstnode.create(1,booltype,true);
+                     t:=Cordconstnode.create(1,pasbool8type,true);
                  gten :
                    if lv<low then
-                     t:=Cordconstnode.create(0,booltype,true)
+                     t:=Cordconstnode.create(0,pasbool8type,true)
                    else if lv>=high then
-                     t:=Cordconstnode.create(1,booltype,true);
+                     t:=Cordconstnode.create(1,pasbool8type,true);
                  equaln:
                    if (lv<low) or (lv>high) then
-                     t:=Cordconstnode.create(0,booltype,true);
+                     t:=Cordconstnode.create(0,pasbool8type,true);
                  unequaln:
                    if (lv<low) or (lv>high) then
-                     t:=Cordconstnode.create(1,booltype,true);
+                     t:=Cordconstnode.create(1,pasbool8type,true);
                 end;
               if t<>nil then
                 begin
@@ -436,30 +436,30 @@ implementation
                 case nodetype of
                  ltn:
                    if high<rv then
-                     t:=Cordconstnode.create(1,booltype,true)
+                     t:=Cordconstnode.create(1,pasbool8type,true)
                    else if low>=rv then
-                     t:=Cordconstnode.create(0,booltype,true);
+                     t:=Cordconstnode.create(0,pasbool8type,true);
                  lten:
                    if high<=rv then
-                     t:=Cordconstnode.create(1,booltype,true)
+                     t:=Cordconstnode.create(1,pasbool8type,true)
                    else if low>rv then
-                     t:=Cordconstnode.create(0,booltype,true);
+                     t:=Cordconstnode.create(0,pasbool8type,true);
                  gtn:
                    if high<=rv then
-                     t:=Cordconstnode.create(0,booltype,true)
+                     t:=Cordconstnode.create(0,pasbool8type,true)
                    else if low>rv then
-                     t:=Cordconstnode.create(1,booltype,true);
+                     t:=Cordconstnode.create(1,pasbool8type,true);
                  gten:
                    if high<rv then
-                     t:=Cordconstnode.create(0,booltype,true)
+                     t:=Cordconstnode.create(0,pasbool8type,true)
                    else if low>=rv then
-                     t:=Cordconstnode.create(1,booltype,true);
+                     t:=Cordconstnode.create(1,pasbool8type,true);
                  equaln:
                    if (rv<low) or (rv>high) then
-                     t:=Cordconstnode.create(0,booltype,true);
+                     t:=Cordconstnode.create(0,pasbool8type,true);
                  unequaln:
                    if (rv<low) or (rv>high) then
-                     t:=Cordconstnode.create(1,booltype,true);
+                     t:=Cordconstnode.create(1,pasbool8type,true);
                 end;
               if t<>nil then
                 begin
@@ -563,17 +563,17 @@ implementation
                 slashn :
                   t:=crealconstnode.create(lvd/rvd,resultrealdef);
                 ltn :
-                  t:=cordconstnode.create(ord(lvd<rvd),booltype,true);
+                  t:=cordconstnode.create(ord(lvd<rvd),pasbool8type,true);
                 lten :
-                  t:=cordconstnode.create(ord(lvd<=rvd),booltype,true);
+                  t:=cordconstnode.create(ord(lvd<=rvd),pasbool8type,true);
                 gtn :
-                  t:=cordconstnode.create(ord(lvd>rvd),booltype,true);
+                  t:=cordconstnode.create(ord(lvd>rvd),pasbool8type,true);
                 gten :
-                  t:=cordconstnode.create(ord(lvd>=rvd),booltype,true);
+                  t:=cordconstnode.create(ord(lvd>=rvd),pasbool8type,true);
                 equaln :
-                  t:=cordconstnode.create(ord(lvd=rvd),booltype,true);
+                  t:=cordconstnode.create(ord(lvd=rvd),pasbool8type,true);
                 unequaln :
-                  t:=cordconstnode.create(ord(lvd<>rvd),booltype,true);
+                  t:=cordconstnode.create(ord(lvd<>rvd),pasbool8type,true);
                 else
                   internalerror(2008022102);
              end;
@@ -602,17 +602,17 @@ implementation
                      t:=cstringconstnode.createwstr(ws1);
                   end;
                 ltn :
-                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<0),booltype,true);
+                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<0),pasbool8type,true);
                 lten :
-                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<=0),booltype,true);
+                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<=0),pasbool8type,true);
                 gtn :
-                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>0),booltype,true);
+                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>0),pasbool8type,true);
                 gten :
-                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>=0),booltype,true);
+                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>=0),pasbool8type,true);
                 equaln :
-                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)=0),booltype,true);
+                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)=0),pasbool8type,true);
                 unequaln :
-                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<>0),booltype,true);
+                  t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<>0),pasbool8type,true);
                 else
                   internalerror(2008022103);
              end;
@@ -676,17 +676,17 @@ implementation
                     tstringconstnode(t).changestringtype(resultdef);
                   end;
                 ltn :
-                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),booltype,true);
+                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),pasbool8type,true);
                 lten :
-                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),booltype,true);
+                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),pasbool8type,true);
                 gtn :
-                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),booltype,true);
+                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),pasbool8type,true);
                 gten :
-                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),booltype,true);
+                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),pasbool8type,true);
                 equaln :
-                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),booltype,true);
+                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),pasbool8type,true);
                 unequaln :
-                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),booltype,true);
+                  t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),pasbool8type,true);
                 else
                   internalerror(2008022104);
              end;
@@ -724,22 +724,22 @@ implementation
                unequaln :
                   begin
                     b:=tsetconstnode(right).value_set^ <> tsetconstnode(left).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype,true);
+                    t:=cordconstnode.create(byte(b),pasbool8type,true);
                   end;
                equaln :
                   begin
                     b:=tsetconstnode(right).value_set^ = tsetconstnode(left).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype,true);
+                    t:=cordconstnode.create(byte(b),pasbool8type,true);
                   end;
                lten :
                   begin
                     b:=tsetconstnode(left).value_set^ <= tsetconstnode(right).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype,true);
+                    t:=cordconstnode.create(byte(b),pasbool8type,true);
                   end;
                gten :
                   begin
                     b:=tsetconstnode(left).value_set^ >= tsetconstnode(right).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype,true);
+                    t:=cordconstnode.create(byte(b),pasbool8type,true);
                   end;
                 else
                   internalerror(2008022105);
@@ -1027,12 +1027,12 @@ implementation
                 begin
                   if not is_boolean(ld) then
                     begin
-                      inserttypeconv(left,booltype);
+                      inserttypeconv(left,pasbool8type);
                       ld := left.resultdef;
                     end;
                   if not is_boolean(rd) then
                     begin
-                      inserttypeconv(right,booltype);
+                      inserttypeconv(right,pasbool8type);
                       rd := right.resultdef;
                     end;
                 end;
@@ -1857,7 +1857,7 @@ implementation
           begin
              case nodetype of
                 ltn,lten,gtn,gten,equaln,unequaln :
-                  resultdef:=booltype;
+                  resultdef:=pasbool8type;
                 slashn :
                   resultdef:=resultrealdef;
                 addn:
@@ -2327,7 +2327,7 @@ implementation
 
         { otherwise, create the parameters for the helper }
         right := ccallparanode.create(
-          cordconstnode.create(ord(cs_check_overflow in current_settings.localswitches),booltype,true),
+          cordconstnode.create(ord(cs_check_overflow in current_settings.localswitches),pasbool8type,true),
           ccallparanode.create(right,ccallparanode.create(left,nil)));
         left := nil;
         { only qword needs the unsigned code, the
@@ -2457,7 +2457,7 @@ implementation
         if not(target_info.system in systems_wince) then
           begin
             if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then
-              resultdef:=booltype;
+              resultdef:=pasbool8type;
             result:=ctypeconvnode.create_internal(ccallnode.createintern(procname,ccallparanode.create(
                 ctypeconvnode.create_internal(right,fdef),
                 ccallparanode.create(
@@ -2618,7 +2618,7 @@ implementation
                          internalerror(2011022301);
                      end;
                      result := ccallnode.createintern(procname,
-                       ccallparanode.create(cordconstnode.create(0,booltype,false),
+                       ccallparanode.create(cordconstnode.create(0,pasbool8type,false),
                        ccallparanode.create(right,
                        ccallparanode.create(left,nil))));
                      left := nil;

+ 2 - 2
compiler/ncal.pas

@@ -2340,12 +2340,12 @@ implementation
                 else
                  if vo_is_range_check in para.parasym.varoptions then
                    begin
-                     para.left:=cordconstnode.create(Ord(cs_check_range in current_settings.localswitches),booltype,false);
+                     para.left:=cordconstnode.create(Ord(cs_check_range in current_settings.localswitches),pasbool8type,false);
                    end
                 else
                  if vo_is_overflow_check in para.parasym.varoptions then
                    begin
-                     para.left:=cordconstnode.create(Ord(cs_check_overflow in current_settings.localswitches),booltype,false);
+                     para.left:=cordconstnode.create(Ord(cs_check_overflow in current_settings.localswitches),pasbool8type,false);
                    end
                 else
                   if vo_is_msgsel in para.parasym.varoptions then

+ 8 - 7
compiler/ncgrtti.pas

@@ -452,7 +452,7 @@ implementation
           end;
           { we need to align by Tconstptruint here to satisfy the alignment rules set by
             records: in the typinfo unit we overlay a TTypeData record on this data, which at
-            the innermost variant record needs an alignment of TConstPtrUint due to e.g. 
+            the innermost variant record needs an alignment of TConstPtrUint due to e.g.
             the "CompType" member for tkSet (also the "BaseType" member for tkEnumeration).
             We need to adhere to this, otherwise things will break.
             Note that other code (e.g. enumdef_rtti_calcstringtablestart()) relies on the
@@ -490,7 +490,8 @@ implementation
               (otUByte{otNone},
                otUByte,otUWord,otULong,otUByte{otNone},
                otSByte,otSWord,otSLong,otUByte{otNone},
-               otUByte,otSByte,otSWord,otSLong,otSByte,
+               otUByte,otUWord,otULong,otUByte,
+               otSByte,otSWord,otSLong,otSByte,
                otUByte,otUWord,otUByte);
           begin
             write_header(def,typekind);
@@ -523,7 +524,7 @@ implementation
                 { high }
                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_64bit(def.high.svalue));
               end;
-            pasbool:
+            pasbool8:
                 dointeger(tkBool);
             uchar:
                 dointeger(tkChar);
@@ -698,18 +699,18 @@ implementation
                  potype_class_constructor: methodkind:=mkClassConstructor;
                  potype_class_destructor: methodkind:=mkClassDestructor;
                  potype_operator: methodkind:=mkOperatorOverload;
-                 potype_procedure: 
-                   if po_classmethod in def.procoptions then 
+                 potype_procedure:
+                   if po_classmethod in def.procoptions then
                      methodkind:=mkClassProcedure
                    else
                      methodkind:=mkProcedure;
                  potype_function:
-                   if po_classmethod in def.procoptions then 
+                   if po_classmethod in def.procoptions then
                      methodkind:=mkClassFunction
                    else
                      methodkind:=mkFunction;
                else
-                 begin                   
+                 begin
                    if def.returndef = voidtype then
                      methodkind:=mkProcedure
                    else

+ 4 - 4
compiler/ncnv.pas

@@ -913,7 +913,7 @@ implementation
             addstatement(newstat,restemp);
             addstatement(newstat,ccallnode.createintern('fpc_'+chartype+'array_to_shortstr',
               ccallparanode.create(cordconstnode.create(
-                ord(tarraydef(left.resultdef).lowrange=0),booltype,false),
+                ord(tarraydef(left.resultdef).lowrange=0),pasbool8type,false),
               ccallparanode.create(left,ccallparanode.create(
               ctemprefnode.create(restemp),nil)))));
             addstatement(newstat,ctempdeletenode.create_normal_temp(restemp));
@@ -924,7 +924,7 @@ implementation
           result:=ccallnode.createinternres(
             'fpc_'+chartype+'array_to_'+tstringdef(resultdef).stringtypname,
             ccallparanode.create(cordconstnode.create(
-               ord(tarraydef(left.resultdef).lowrange=0),booltype,false),
+               ord(tarraydef(left.resultdef).lowrange=0),pasbool8type,false),
              ccallparanode.create(left,nil)),resultdef);
         left:=nil;
       end;
@@ -3347,7 +3347,7 @@ implementation
               CGMessage1(type_e_class_or_cominterface_type_expected,left.resultdef.typename);
             case nodetype of
               isn:
-                resultdef:=booltype;
+                resultdef:=pasbool8type;
               asn:
                 resultdef:=tclassrefdef(right.resultdef).pointeddef;
             end;
@@ -3361,7 +3361,7 @@ implementation
 
             case nodetype of
               isn:
-                resultdef:=booltype;
+                resultdef:=pasbool8type;
               asn:
                 resultdef:=right.resultdef;
             end;

+ 4 - 4
compiler/nflw.pas

@@ -457,7 +457,7 @@ implementation
           one }
         hp:=cwhilerepeatnode.create(
           { repeat .. until false }
-          cordconstnode.create(0,booltype,false),innerloop,false,true);
+          cordconstnode.create(0,pasbool8type,false),innerloop,false,true);
         addstatement(outerloopbodystatement,hp);
 
         { create the outer repeat/until and add it to the the main body }
@@ -1074,7 +1074,7 @@ implementation
            not(is_typeparam(left.resultdef)) then
            begin
              if left.resultdef.typ=variantdef then
-               inserttypeconv(left,booltype)
+               inserttypeconv(left,pasbool8type)
              else
                CGMessage1(type_e_boolean_expr_expected,left.resultdef.typename);
            end;
@@ -1311,7 +1311,7 @@ implementation
             end;
         if not is_constboolnode(condition) then
             aktstate.store_fact(condition,
-             cordconstnode.create(byte(checknegate),booltype,true))
+             cordconstnode.create(byte(checknegate),pasbool8type,true))
         else
             condition.destroy;
     end;
@@ -1387,7 +1387,7 @@ implementation
            not(is_typeparam(left.resultdef)) then
            begin
              if left.resultdef.typ=variantdef then
-               inserttypeconv(left,booltype)
+               inserttypeconv(left,pasbool8type)
              else
                Message1(type_e_boolean_expr_expected,left.resultdef.typename);
            end;

+ 24 - 7
compiler/ninl.pas

@@ -314,7 +314,8 @@ implementation
             scurrency,
             s64bit:
               procname := procname + 'int64';
-            pasbool,bool8bit,bool16bit,bool32bit,bool64bit:
+            pasbool8,pasbool16,pasbool32,pasbool64,
+            bool8bit,bool16bit,bool32bit,bool64bit:
               procname := procname + 'bool';
 {$endif}
             else
@@ -511,7 +512,10 @@ implementation
                       readfunctype:=s64currencytype;
                       is_real:=true;
                     end;
-                  pasbool,
+                  pasbool8,
+                  pasbool16,
+                  pasbool32,
+                  pasbool64,
                   bool8bit,
                   bool16bit,
                   bool32bit,
@@ -524,7 +528,7 @@ implementation
                     else
                       begin
                         name := procprefixes[do_read]+'boolean';
-                        readfunctype:=booltype;
+                        readfunctype:=pasbool8type;
                       end
                   else
                     begin
@@ -746,7 +750,7 @@ implementation
                   { zero-based                                       }
                   if para.left.resultdef.typ=arraydef then
                     para := ccallparanode.create(cordconstnode.create(
-                      ord(tarraydef(para.left.resultdef).lowrange=0),booltype,false),para);
+                      ord(tarraydef(para.left.resultdef).lowrange=0),pasbool8type,false),para);
                   { create the call statement }
                   addstatement(Tstatementnode(newstatement),
                     ccallnode.createintern(name,para));
@@ -1635,7 +1639,7 @@ implementation
                    else
                      hp:=create_simplified_ord_const(sqr(vl.uvalue),resultdef,forinline);
                  in_const_odd :
-                   hp:=cordconstnode.create(qword(odd(int64(vl))),booltype,true);
+                   hp:=cordconstnode.create(qword(odd(int64(vl))),pasbool8type,true);
                  in_const_swap_word :
                    hp:=cordconstnode.create((vl and $ff) shl 8+(vl shr 8),left.resultdef,true);
                  in_const_swap_long :
@@ -1691,19 +1695,32 @@ implementation
                     orddef :
                       begin
                         case torddef(left.resultdef).ordtype of
-                          pasbool,
+                          pasbool8,
                           uchar:
                             begin
                               { change to byte() }
                               result:=ctypeconvnode.create_internal(left,u8inttype);
                               left:=nil;
                             end;
+                          pasbool16,
                           uwidechar :
                             begin
                               { change to word() }
                               result:=ctypeconvnode.create_internal(left,u16inttype);
                               left:=nil;
                             end;
+                          pasbool32 :
+                            begin
+                              { change to dword() }
+                              result:=ctypeconvnode.create_internal(left,u32inttype);
+                              left:=nil;
+                            end;
+                          pasbool64 :
+                            begin
+                              { change to qword() }
+                              result:=ctypeconvnode.create_internal(left,u64inttype);
+                              left:=nil;
+                            end;
                           bool8bit:
                             begin
                               { change to shortint() }
@@ -2357,7 +2374,7 @@ implementation
                     in procvar handling between FPC and Delphi handling, so
                     handle specially }
                   set_varstate(tcallparanode(left).left,vs_read,[vsf_must_be_valid]);
-                  resultdef:=booltype;
+                  resultdef:=pasbool8type;
                 end;
 
               in_ofs_x :

+ 5 - 2
compiler/nmat.pas

@@ -884,14 +884,17 @@ implementation
              v:=tordconstnode(left).value;
              def:=left.resultdef;
              case torddef(left.resultdef).ordtype of
-               pasbool,
+               pasbool8,
+               pasbool16,
+               pasbool32,
+               pasbool64,
                bool8bit,
                bool16bit,
                bool32bit,
                bool64bit:
                  begin
                    v:=byte(not(boolean(int64(v))));
-                   if (torddef(left.resultdef).ordtype<>pasbool) then
+                   if is_cbool(left.resultdef) then
                      v:=-v;
                  end;
                uchar,

+ 6 - 6
compiler/nset.pas

@@ -213,7 +213,7 @@ implementation
 
       begin
          result:=nil;
-         resultdef:=booltype;
+         resultdef:=pasbool8type;
          typecheckpass(right);
          set_varstate(right,vs_read,[vsf_must_be_valid]);
          if codegenerror then
@@ -256,7 +256,7 @@ implementation
              }
              if  (
                    (left.resultdef.typ = orddef) and not
-                   (torddef(left.resultdef).ordtype in [s8bit,u8bit,uchar,pasbool,bool8bit])
+                   (torddef(left.resultdef).ordtype in [s8bit,u8bit,uchar,pasbool8,bool8bit])
                  )
                 or
                  (
@@ -294,7 +294,7 @@ implementation
             ((right.nodetype = setconstn) and
              (tnormalset(tsetconstnode(right).value_set^) = [])) then
           begin
-            t:=cordconstnode.create(0,booltype,false);
+            t:=cordconstnode.create(0,pasbool8type,false);
             typecheckpass(t);
             result:=t;
             exit;
@@ -321,10 +321,10 @@ implementation
                  { into account                                             }
                  if Tordconstnode(left).value.signed then
                    t:=cordconstnode.create(byte(tordconstnode(left).value.svalue in Tsetconstnode(right).value_set^),
-                     booltype,true)
+                     pasbool8type,true)
                  else
                    t:=cordconstnode.create(byte(tordconstnode(left).value.uvalue in Tsetconstnode(right).value_set^),
-                     booltype,true);
+                     pasbool8type,true);
                  typecheckpass(t);
                  result:=t;
                  exit;
@@ -334,7 +334,7 @@ implementation
                  if (Tordconstnode(left).value<int64(tsetdef(right.resultdef).setbase)) or
                     (Tordconstnode(left).value>int64(Tsetdef(right.resultdef).setmax)) then
                    begin
-                     t:=cordconstnode.create(0, booltype, true);
+                     t:=cordconstnode.create(0, pasbool8type, true);
                      typecheckpass(t);
                      result:=t;
                      exit;

+ 1 - 1
compiler/pdecsub.pas

@@ -1468,7 +1468,7 @@ implementation
                        end;
                      if (optoken in [_EQ,_NE,_GT,_LT,_GTE,_LTE,_OP_IN]) and
                         ((pd.returndef.typ<>orddef) or
-                         (torddef(pd.returndef).ordtype<>pasbool)) then
+                         (torddef(pd.returndef).ordtype<>pasbool8)) then
                         Message(parser_e_comparative_operator_return_boolean);
                      if (optoken in [_ASSIGNMENT,_OP_EXPLICIT]) and
                         equal_defs(pd.returndef,tparavarsym(pd.parast.SymList[0]).vardef) and

+ 1 - 1
compiler/pdecvar.pas

@@ -674,7 +674,7 @@ implementation
                                    storedprocdef:=tprocvardef.create(normal_function_level);
                                    include(storedprocdef.procoptions,po_methodpointer);
                                    { Return type must be boolean }
-                                   storedprocdef.returndef:=booltype;
+                                   storedprocdef.returndef:=pasbool8type;
                                    { Add index parameter if needed }
                                    if ppo_indexed in p.propoptions then
                                      begin

+ 2 - 2
compiler/pexpr.pas

@@ -2745,13 +2745,13 @@ implementation
              _TRUE :
                begin
                  consume(_TRUE);
-                 p1:=cordconstnode.create(1,booltype,false);
+                 p1:=cordconstnode.create(1,pasbool8type,false);
                end;
 
              _FALSE :
                begin
                  consume(_FALSE);
-                 p1:=cordconstnode.create(0,booltype,false);
+                 p1:=cordconstnode.create(0,pasbool8type,false);
                end;
 
              _NIL :

+ 11 - 8
compiler/psystem.pas

@@ -154,7 +154,10 @@ implementation
         s32inttype:=torddef.create(s32bit,int64(low(longint)),int64(high(longint)));
         u64inttype:=torddef.create(u64bit,low(qword),high(qword));
         s64inttype:=torddef.create(s64bit,low(int64),high(int64));
-        booltype:=torddef.create(pasbool,0,1);
+        pasbool8type:=torddef.create(pasbool8,0,1);
+        pasbool16type:=torddef.create(pasbool16,0,1);
+        pasbool32type:=torddef.create(pasbool32,0,1);
+        pasbool64type:=torddef.create(pasbool64,0,1);
         bool8type:=torddef.create(bool8bit,low(int64),high(int64));
         bool16type:=torddef.create(bool16bit,low(int64),high(int64));
         bool32type:=torddef.create(bool32bit,low(int64),high(int64));
@@ -293,7 +296,7 @@ implementation
         addtype('UnicodeString',cunicodestringtype);
 
         addtype('OpenString',openshortstringtype);
-        addtype('Boolean',booltype);
+        addtype('Boolean',pasbool8type);
         addtype('ByteBool',bool8type);
         addtype('WordBool',bool16type);
         addtype('LongBool',bool32type);
@@ -333,7 +336,7 @@ implementation
         addtype('$widestring',cwidestringtype);
         addtype('$unicodestring',cunicodestringtype);
         addtype('$openshortstring',openshortstringtype);
-        addtype('$boolean',booltype);
+        addtype('$boolean',pasbool8type);
         addtype('$boolean8',bool8type);
         addtype('$boolean16',bool16type);
         addtype('$boolean32',bool32type);
@@ -438,11 +441,11 @@ implementation
             loadtype('sc80real',sc80floattype);
           end;
         loadtype('s64currency',s64currencytype);
-        loadtype('boolean',booltype);
-        loadtype('boolean8',bool8type);
-        loadtype('boolean16',bool16type);
-        loadtype('boolean32',bool32type);
-        loadtype('boolean64',bool64type);
+        loadtype('boolean',pasbool8type);
+        loadtype('boolean8',pasbool8type);
+        loadtype('boolean16',pasbool16type);
+        loadtype('boolean32',pasbool32type);
+        loadtype('boolean64',pasbool64type);
         loadtype('void_pointer',voidpointertype);
         loadtype('char_pointer',charpointertype);
         loadtype('widechar_pointer',widecharpointertype);

+ 4 - 1
compiler/ptconst.pas

@@ -196,7 +196,7 @@ implementation
            if is_cbool(def) then
              inserttypeconv(n,def);
            case def.ordtype of
-              pasbool,
+              pasbool8,
               bool8bit :
                 begin
                    if is_constboolnode(n) then
@@ -204,6 +204,7 @@ implementation
                    else
                      do_error;
                 end;
+              pasbool16,
               bool16bit :
                 begin
                    if is_constboolnode(n) then
@@ -211,6 +212,7 @@ implementation
                    else
                      do_error;
                 end;
+              pasbool32,
               bool32bit :
                 begin
                    if is_constboolnode(n) then
@@ -218,6 +220,7 @@ implementation
                    else
                      do_error;
                 end;
+              pasbool64,
               bool64bit :
                 begin
                    if is_constboolnode(n) then

+ 4 - 3
compiler/ptype.pas

@@ -685,7 +685,7 @@ implementation
                 member_blocktype:=bt_type;
 
                 { local and anonymous records can not have inner types. skip top record symtable }
-                if (current_structdef.objname^='') or 
+                if (current_structdef.objname^='') or
                    not(symtablestack.stack^.next^.symtable.symtabletype in [globalsymtable,staticsymtable,objectsymtable,recordsymtable]) then
                   Message(parser_e_no_types_in_local_anonymous_records);
               end;
@@ -1052,7 +1052,7 @@ implementation
                                def:=torddef.create(uchar,lv,hv)
                              else
                                if is_boolean(pt1.resultdef) then
-                                 def:=torddef.create(pasbool,lv,hv)
+                                 def:=torddef.create(pasbool8,lv,hv)
                                else if is_signed(pt1.resultdef) then
                                  def:=torddef.create(range_to_basetype(lv,hv),lv,hv)
                                else
@@ -1172,7 +1172,8 @@ implementation
 {$ifdef cpu64bitaddr}
                     u32bit,s64bit,
 {$endif cpu64bitaddr}
-                    pasbool,bool8bit,bool16bit,bool32bit,bool64bit,
+                    pasbool8,pasbool16,pasbool32,pasbool64,
+                    bool8bit,bool16bit,bool32bit,bool64bit,
                     uwidechar] then
                     begin
                        lowval:=torddef(def).low;

+ 2 - 1
compiler/symconst.pas

@@ -210,7 +210,8 @@ type
     uvoid,
     u8bit,u16bit,u32bit,u64bit,
     s8bit,s16bit,s32bit,s64bit,
-    pasbool,bool8bit,bool16bit,bool32bit,bool64bit,
+    pasbool8,pasbool16,pasbool32,pasbool64,
+    bool8bit,bool16bit,bool32bit,bool64bit,
     uchar,uwidechar,scurrency
   );
 

+ 12 - 5
compiler/symdef.pas

@@ -677,7 +677,10 @@ interface
        voidtype,                  { Void (procedure) }
        cchartype,                 { Char }
        cwidechartype,             { WideChar }
-       booltype,                  { boolean type }
+       pasbool8type,              { boolean type }
+       pasbool16type,
+       pasbool32type,
+       pasbool64type,
        bool8type,
        bool16type,
        bool32type,
@@ -1766,7 +1769,8 @@ implementation
           0,
           1,2,4,8,
           1,2,4,8,
-          1,1,2,4,8,
+          1,2,4,8,
+          1,2,4,8,
           1,2,8
         );
       begin
@@ -1815,7 +1819,8 @@ implementation
           varUndefined,
           varbyte,varword,varlongword,varqword,
           varshortint,varsmallint,varinteger,varint64,
-          varboolean,varboolean,varboolean,varUndefined,varUndefined,
+          varboolean,varboolean,varboolean,varboolean,
+          varboolean,varboolean,varUndefined,varUndefined,
           varUndefined,varUndefined,varCurrency);
       begin
         result:=basetype2vardef[ordtype];
@@ -1844,7 +1849,8 @@ implementation
           'untyped',
           'Byte','Word','DWord','QWord',
           'ShortInt','SmallInt','LongInt','Int64',
-          'Boolean','ByteBool','WordBool','LongBool','QWordBool',
+          'Boolean','Boolean16','Boolean32','Boolean64',
+          'ByteBool','WordBool','LongBool','QWordBool',
           'Char','WideChar','Currency');
 
       begin
@@ -3929,7 +3935,8 @@ implementation
              'v',
              'h','t','j','y',
              'a','s','i','x',
-             'b','b','b','b','b',
+             'b','b','b','b',
+             'b','b','b','b',
              'c','w','x');
 
            floattype2str : array[tfloattype] of string[1] = (

+ 1 - 1
compiler/x86/cgx86.pas

@@ -2208,7 +2208,7 @@ unit cgx86;
          current_asmdata.getjumplabel(hl);
          if not ((def.typ=pointerdef) or
                 ((def.typ=orddef) and
-                 (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar,pasbool]))) then
+                 (torddef(def).ordtype in [u64bit,u16bit,u32bit,u8bit,uchar,pasbool8,pasbool16,pasbool32,pasbool64]))) then
            cond:=C_NO
          else
            cond:=C_NB;