[swift-dev] long double usage in swift

Saleem Abdulrasool compnerd at compnerd.org
Wed Mar 23 16:28:54 CDT 2016


Sorry, hit send too quickly:

Inputs/abi.h:

float fp32_call(void);
double fp64_call(void);
long double fp80_call(void);

Inputs/module.map:

module abi {
  header "abi.h"
}

test.swift:

%swift -I Inputs -parse %s
import abi

@inline(never)
func blackhole<T>(t : T) { }

func test_floating_point() {
  blackhole(fp32_call())
  blackhole(fp64_call())
#if LONG_DOUBLE
  blackhole(fp80_call())
#endif
}

Compiling with -DLONG_DOUBLE will result in an error:
  error: use of unresolved identifier 'fp80_call'.

Ive tested this with clang, and using this in a module (-fmodules
-fmodule-cache-path=/tmp) seems to work fine, so I don't believe that this
is an issue with modules.

On Wed, Mar 23, 2016 at 2:25 PM, Saleem Abdulrasool <compnerd at compnerd.org>
wrote:

> Hi,
>
> I was looking at an ABI related issue on Windows.  In trying to construct
> a test case, it seems that I am unable to import a declaration using a long
> double into swift.  I was wondering if there is something about long double
> usage in swift that I am unaware of.
>
> Inputs/abi.h:
>
> float fp32_call(void);
> double fp64_call(void);
> long double fp80_call(void);
>
> Inputs/module.map:
>
> module abi {
>   header "abi.h"
> }
>
> test.swift:
>
> %swift -I Inputs -parse %s
> import abi
>
> @inline(never)
> func blackhole<T>(t : T) { }
>
> func test_floating_point() {
> }
>
> Thanks!
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160323/797b1b20/attachment.html>


More information about the swift-dev mailing list