www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22535] New: ImportC: gcc/clang math intrinsics are rejected.

https://issues.dlang.org/show_bug.cgi?id=22535

          Issue ID: 22535
           Summary: ImportC: gcc/clang math intrinsics are rejected.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

math.h on macOS uses the following gcc/clang builtins:

`__builtin_fabs`
`__builtin_fabsf`
`__builtin_fabsl
`__builtin_fabsl`
`__builtin_inf`
`__builtin_inff`
`__builtin_infl`

A much larger list of these builtins are described here:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

It’s common for this header to be directly or transitively included. It is
possible at least on macOS to avoid these if you preprocess with the
-ffast-math flag as then it will counterintuitively declare extern versions of
functions like isfinite instead of defining them as inline functions using
these intrinsics.

I don’t know if we want dmd to actually recognize all of these intrinsics.

--
Nov 21 2021