Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

add nothrow to windows files#3797

Merged
RazvanN7 merged 1 commit intodlang:masterfrom
WalterBright:nothrow
Apr 28, 2022
Merged

add nothrow to windows files#3797
RazvanN7 merged 1 commit intodlang:masterfrom
WalterBright:nothrow

Conversation

@WalterBright
Copy link
Copy Markdown
Member

No description provided.

@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3797"

@WalterBright
Copy link
Copy Markdown
Member Author

blocking dlang/dmd#13960

@dkorpel
Copy link
Copy Markdown
Contributor

dkorpel commented Apr 8, 2022

blocking dlang/dmd#13960

Like mentioned in the other PR, this doesn't unblock dmd, because the newest DMD source needs to be compilable with 5 year old DMD as well.

@rainers
Copy link
Copy Markdown
Member

rainers commented Apr 8, 2022

This is ok just as adding @nogc was in the other PR, because the attributes are not applied to the interfaces. But that also means it doesn't unblock the dmd PR: calling IUnknown.Release is still not nothrow (BTW: some declarations in oleauto.d must also be nothrow).

If you desperately want to add the attributes while also compiling with older versions of dmd, you'll have to redeclare the interface and functions in vsoptions.d:

import core.sys.windows.com;
import core.sys.windows.wtypes : BSTR;
import core.sys.windows.basetyps;

nothrow:
extern (Windows) {
    // redeclared here to add attributes NOW
    interface IUnknown {
    nothrow:
        HRESULT QueryInterface(IID* riid, void** pvObject);
        ULONG AddRef();
        ULONG Release();
    }

    HRESULT CoCreateInstance(REFCLSID, IUnknown, DWORD, REFIID, PVOID*);
    void CoUninitialize();
    HRESULT CoInitialize(PVOID);
    void SysFreeString(BSTR);
    uint SysStringLen(BSTR);
}

@RazvanN7
Copy link
Copy Markdown
Contributor

ping @WalterBright

Copy link
Copy Markdown
Member

@rainers rainers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are ok and non-breaking, because they don't affect the interfaces.

@RazvanN7 RazvanN7 merged commit 360d3e7 into dlang:master Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants