Bug 24620 – ImportC: Missing builtins floating point (GCC)

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-06-20T17:48:01Z
Last change time
2024-12-13T19:35:53Z
Keywords
ImportC
Assigned to
No Owner
Creator
ryuukk_
Moved to GitHub: dmd#18249 →

Comments

Comment #0 by ryuukk.dev — 2024-06-20T17:48:01Z
clone: https://github.com/DaveGamble/cJSON create: 'it.c' (otherwise it complains about `main.d(5): Error: import `main.cJSON` is used as a type`) ``` #include "cJSON.c" ``` create: 'main.d' ```D import it; void main() { cJSON* request = cJSON_Parse(null); } ``` compile&run: 'dmd main.d it.c -of=bug && ./bug' ``` $ dmd main.d it.c -of=bug && ./bug In file included from <command-line>: /usr/include/dlang/dmd/importc.h:101:8: warning: undefining "__has_feature" 101 | #undef __has_feature | ^~~~~~~~~~~~~ /usr/include/dlang/dmd/importc.h:104:8: warning: undefining "__has_extension" 104 | #undef __has_extension | ^~~~~~~~~~~~~~~ cJSON.c(569): Error: undefined identifier `__builtin_isinf_sign` cJSON.c(1205): Error: `buffer` is not a member of `printbuffer[1]` cJSON.c(1206): Error: `length` is not a member of `printbuffer[1]` cJSON.c(1207): Error: `format` is not a member of `printbuffer[1]` cJSON.c(1208): Error: `hooks` is not a member of `printbuffer[1]` cJSON.c(1228): Error: `buffer` is not a member of `printbuffer[1]` cJSON.c(1242): Error: `buffer` is not a member of `printbuffer[1]` cJSON.c(1251): Error: `buffer` is not a member of `printbuffer[1]` ```
Comment #1 by dfj1esp02 — 2024-06-21T07:11:56Z
It's `isinf` definition on your system.
Comment #2 by alphaglosined — 2024-06-21T07:41:29Z
Comment #3 by lance — 2024-09-21T01:25:28Z
I hit the same issue with C code calling na. Error message: Error: undefined identifier `__builtin_isinf_sign` Adding this to the top of the file fixed it: typedef isinf __builtin_isinf_sign;
Comment #4 by robert.schadek — 2024-12-13T19:35:53Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18249 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB