Thread overview
[Issue 23935] ImportC for libuv
May 24, 2023
a11e99z
May 24, 2023
a11e99z
May 24, 2023
a11e99z
May 24, 2023
a11e99z
May 26, 2023
Walter Bright
[Issue 23935] ImportC: __pragma not allowed between struct and tag name
May 30, 2023
Walter Bright
May 30, 2023
Dlang Bot
May 30, 2023
Dlang Bot
May 24, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

--- Comment #1 from a11e99z <black80@bk.ru> ---
so 1st simple step:
dmd/importc can not eat unsigned __intXX:
    typedef unsigned __int64  uintptr_t;
gives:
Error: missing comma or semicolon after declaration of `__anonymous`, found
`uintptr_t` instead

--
May 24, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

a11e99z <black80@bk.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1875|0                           |1
        is obsolete|                            |

--- Comment #2 from a11e99z <black80@bk.ru> ---
Created attachment 1876
  --> https://issues.dlang.org/attachment.cgi?id=1876&action=edit
comressed uv9.i after fixing some issues

preprocessed header with command:
cl.exe -P -Fiuv.i -DUSING_UV_SHARED -DWIN32_LEAN_AND_MEAN -D__int64="long long"
-D__int32="long" -D__cdecl="" -D__inline="inline" -D__forceinline="inline"
-D__ptr64="" -D__ptr32="" -D__unaligned="" /std:c11 uv.h

--
May 24, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

--- Comment #3 from a11e99z <black80@bk.ru> ---
still fixing issues manually
hint: '\' means code follows on next line w/o line break
todo: ignore it in parser?

--
May 24, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

--- Comment #4 from a11e99z <black80@bk.ru> ---
fixed manually. not checked yet with calling libuv from D, but dmd gives uv9.obj.

MSVC command:
cl.exe -P -Fiuv.i -DUSING_UV_SHARED -DWIN32_LEAN_AND_MEAN -D__int64="long long"
-D__int32="long" -D__cdecl="" -D__inline="inline" -D__forceinline="inline"
-D__ptr64="" -D__ptr32="" -D__unaligned="" -D_CRT_SECURE_NO_WARNINGS /std:c11
uv.h

and fixing is:
1) changed
typedef struct __declspec(align(16)) __pragma(warning(push))
__pragma(warning(disable:4845)) __declspec(no_init_all) __pragma(warning(pop))
_CONTEXT { ... } CONTEXT, *PCONTEXT;

with issues:
uv9.i(4529): Error: missing tag `identifier` after `struct`


uv9.i(4529): Error: identifier or `(` expected


uv9.i(4598): Error: no type for declarator before `}`


uv9.i(4598): Error: no type-specifier for declarator

to:
typedef struct /*__declspec(align(16)) __pragma(warning(push))
__pragma(warning(disable:4845)) __declspec(no_init_all)
__pragma(warning(pop))*/ _CONTEXT { ... } CONTEXT __attribute__((aligned(
16))), *PCONTEXT;

2) removed '\' (no-line-break here)

with issues:
uv9.i(19384): Error: character '\' is not a valid token


uv9.i(19385): Error: character '\' is not a valid token

(2) should be fixed 100%
(1) hmm, struct attrs should be reordered?

--
May 26, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC
                 CC|                            |bugzilla@digitalmars.com

--
May 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
            Summary|ImportC for libuv           |ImportC: __pragma not
                   |                            |allowed between struct and
                   |                            |tag name

--
May 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #15279 "fix Issue 23935 - ImportC: __pragma not allowed between struct and ta…" fixing this issue:

- fix Issue 23935 - ImportC: __pragma not allowed between struct and tag name

https://github.com/dlang/dmd/pull/15279

--
May 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23935

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15279 "fix Issue 23935 - ImportC: __pragma not allowed between struct and ta…" was merged into master:

- 8e9a91bd4c243892f39f80ec34fcc6927b59d0eb by Walter Bright:
  fix Issue 23935 - ImportC: __pragma not allowed between struct and tag name

https://github.com/dlang/dmd/pull/15279

--