Thread overview
[Issue 23812] ImportC: allow adding function attributes to imported C functions
May 14
ponce
Aug 29
Dlang Bot
Sep 14
Dlang Bot
September 04, 2023
https://issues.dlang.org/show_bug.cgi?id=23812

Steven Schveighoffer <schveiguy@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@gmail.com

--- Comment #1 from Steven Schveighoffer <schveiguy@gmail.com> ---
Yes, I had to remove the nogc and nothrow attributes from my project to get it compiling with importc usage.

I think the defaults have to be as is since we don’t have negation of pure nogc nothrow. But I agree that a pragma would suffice.

--
May 03
https://issues.dlang.org/show_bug.cgi?id=23812

johanengelen@weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
                 CC|                            |johanengelen@weka.io

--
May 14
https://issues.dlang.org/show_bug.cgi?id=23812

ponce <aliloko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aliloko@gmail.com

--- Comment #2 from ponce <aliloko@gmail.com> ---
I've translated a fair share of C and AFAIK they all could be `nothrow @nogc`.

--
August 29
https://issues.dlang.org/show_bug.cgi?id=23812

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

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@tim-dlang created dlang/dmd pull request #16820 "Fix bugzilla 23812 - ImportC: allow adding function attributes to imp…" fixing this issue:

- Fix bugzilla 23812 - ImportC: allow adding function attributes to imported C functions

  This adds a new pragma for ImportC, which allows to set default storage
  classes. Only `nothrow`, `@nogc` and `pure` are supported for now.
  They can be disabled later with the same pragma using a minus.

  Unknown pragmas are ignored.

  The pragma starts with identifier `D` to avoid conflicts.

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

--
September 14
https://issues.dlang.org/show_bug.cgi?id=23812

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

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

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #16820 "Fix bugzilla 23812 - ImportC: allow adding function attributes to imp…" was merged into master:

- d956dc0ccc458a8506a2776ebc1eb00ef5127685 by Tim Schendekehl:
  Fix bugzilla 23812 - ImportC: allow adding function attributes to imported C
functions

  This adds a new pragma for ImportC, which allows to set default storage
  classes. Only `nothrow`, `@nogc` and `pure` are supported for now.
  They can be disabled later using `#pragma attribute(pop)`.

  Unknown storage classes are ignored.

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

--