diff --git a/DataScraping/XML/NamedItems.pas b/DataScraping/XML/NamedItems.pas index 119848da..83829a92 100644 --- a/DataScraping/XML/NamedItems.pas +++ b/DataScraping/XML/NamedItems.pas @@ -168,13 +168,21 @@ public property VendorSuffix: string read vendor_suffix; public property LocalName: string read name; - public function Equals(other: TSelf) := - not ReferenceEquals(other,nil) and (self.api=other.api) and (self.vendor_suffix=other.vendor_suffix) and (self.name=other.name); - public static function operator=(n1,n2: ApiVendorLName) := - if ReferenceEquals(n1, nil) then - ReferenceEquals(n2, nil) else - n1.Equals(n2); + public static function operator=(n1,n2: ApiVendorLName): boolean; + begin + Result := ReferenceEquals(n1, n2); + if Result then exit; + + if ReferenceEquals(n1, nil) then exit; + if ReferenceEquals(n2, nil) then exit; + if n1.api <> n2.api then exit; + if n1.vendor_suffix <> n2.vendor_suffix then exit; + if n1.name <> n2.name then exit; + + Result := true; + end; public static function operator<>(n1,n2: ApiVendorLName) := not(n1=n2); + public function Equals(other: TSelf) := self = other; public function Equals(obj: object): boolean; override := (obj is TSelf(var other)) and (self=other); diff --git a/DataScraping/XML/OpenCL/ScrapXML.pas b/DataScraping/XML/OpenCL/ScrapXML.pas index ffc0d276..143c2d95 100644 --- a/DataScraping/XML/OpenCL/ScrapXML.pas +++ b/DataScraping/XML/OpenCL/ScrapXML.pas @@ -1028,27 +1028,22 @@ function FuncSource.MakeNewItem: Func; Result := new Func(self.Name, self.entry_point_name, pars, nil); - var err_code_gr := GroupSource.FindOrMakeItem(GroupSource.MakeName('cl_error_code',false,false), false); - - var have_err_ret := pars.Any(par->par.ParType.TypeObj = err_code_gr); - - var need_err_ret: boolean; + var need_err_ret_count: integer; if self.Name.LocalName.StartsWith('LogMessagesTo') and (self.Name.VendorSuffix='APPLE') then - need_err_ret := false else + need_err_ret_count := 0 else if self.Name.LocalName.StartsWith('SVM') then - need_err_ret := false else + need_err_ret_count := 0 else if self.Name.LocalName.StartsWith('GetExtensionFunctionAddress') then - need_err_ret := false else - need_err_ret := true; + need_err_ret_count := 0 else + if self.Name = FuncSource.MakeName('clCreateProgramWithBinary', false, false) then + need_err_ret_count := 2 else + need_err_ret_count := 1; - if have_err_ret<>need_err_ret then - begin - - if need_err_ret then - Otp($'WARNING: {Result} does not return errors') else - Otp($'WARNING: {Result} should not return errors'); - - end; + var err_code_gr := GroupSource.FindOrMakeItem(GroupSource.MakeName('cl_error_code',false,false), false); + var err_ret_count := pars.Count(par->par.ParType.TypeObj = err_code_gr); + + if err_ret_count<>need_err_ret_count then + Otp($'WARNING: {Result} was expected to have {need_err_ret_count} err return parameters, but found {err_ret_count}'); end;