Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 15, 2022 [Issue 23189] importC: 0 pointer cast doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ImportC -- |
June 15, 2022 [Issue 23189] importC: 0 pointer cast doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 --- Comment #1 from ryuukk_ <ryuukk.dev@gmail.com> --- Here is a usable code to test: ``` struct nk_table { void* test; }; union nk_page_data { struct nk_table tbl; }; void test(void) { struct nk_table *tbl; union nk_page_data *pd = (union nk_page_data*)((void*)((char*)(1 ? (tbl): &((union nk_page_data*)0)->tbl) - (__builtin_offsetof(union nk_page_data,tbl)))); } ``` -- |
June 15, 2022 [Issue 23189] importC: 0 pointer cast doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 --- Comment #2 from ryuukk_ <ryuukk.dev@gmail.com> --- Oops the code above is the actual fix.. Here the actual problematic code: ``` struct nk_table { void* test; }; union nk_page_data { struct nk_table tbl; }; void test(void) { struct nk_table *tbl; union nk_page_data *pd = (union nk_page_data*)((void*)((char*)(1 ? (tbl): &((union nk_page_data*)0)->tbl) - (__builtin_offsetof(k_page_data,tbl)))); } ``` __builtin_offsetof requires 'union', without it, i get the error: ``` bug.c(15): Error: expression expected, not `)` bug.c(15): Error: found `0` when expecting `)` ``` -- |
June 15, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|importC: 0 pointer cast |importC: __builtin_offsetof |doesn't compile |without struct/union/enum | |doesn't compile -- |
June 15, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 --- Comment #3 from ryuukk_ <ryuukk.dev@gmail.com> --- Ok apparently, it is required to have them, but that was the output of the clang preprocessor.. hmm Anyways.. i think a proper error message would be more useful that what is currently emitted! -- |
June 18, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum should emit proper error message | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|importC: __builtin_offsetof |importC: __builtin_offsetof |without struct/union/enum |without struct/union/enum |doesn't compile |should emit proper error | |message Severity|blocker |normal -- |
September 22, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum should emit proper error message | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> --- (In reply to ryuukk_ from comment #0) > The following code is valid in C, but doesn't compile in ImportC It doesn't compile with gcc either. -- |
September 22, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum should emit proper error message | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> --- I'm not real sure what the problem is you're reporting. It's not clear what you expect to compile? -- |
October 28, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum should emit proper error message | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 --- Comment #6 from ryuukk_ <ryuukk.dev@gmail.com> --- Here is a reduced code: ``` #define NK_OFFSETOF(st,m) (__builtin_offsetof(st,m)) #define NK_ALIGNOF(t) NK_OFFSETOF(struct {char c; t _h;}, _h) struct nk_command{}; void test() { const int align = NK_ALIGNOF(struct nk_command); } ``` // using cpp -P -E ``` void test() { const int align = (__builtin_offsetof(struct {char c; struct nk_command _h;},_h)); } ``` This code compile with GCC, but not with D importc: bar.c(4): Error: expression expected, not `struct` bar.c(4): Error: found `{` when expecting `)` bar.c(4): Error: found `char` when expecting `)` bar.c(4): Error: missing comma or semicolon after declaration of `extern ()`, found `c` instead bar.c(4): Error: identifier or `(` expected bar.c(5): Error: identifier or `(` expected -- |
December 17, 2022 [Issue 23189] importC: __builtin_offsetof without struct/union/enum should emit proper error message | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23189 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation