Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

drop constexpr from root_implements_composable_inner::outer()#1352

Merged
kennykerr merged 1 commit intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
dlech:gcc-nonnull-fixdlech/cppwinrt:gcc-nonnull-fixCopy head branch name to clipboard
Sep 2, 2023
Merged

drop constexpr from root_implements_composable_inner::outer()#1352
kennykerr merged 1 commit intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
dlech:gcc-nonnull-fixdlech/cppwinrt:gcc-nonnull-fixCopy head branch name to clipboard

Conversation

@dlech
Copy link
Contributor

@dlech dlech commented Sep 1, 2023

This removes constexpr from the template <typename D, bool> implementation of root_implements_composable_inner::outer().

This was causing nonnull warnings in GCC such as:

winrt/base.h: In instantiation of 'int32_t winrt::impl::root_implements<D, I>::GetIids(uint32_t*, winrt::guid**) [with D = py::python_iterable<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >::iterator; I = {winrt::Windows::Foundation::Collections::IIterator<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >}; int32_t = int; uint32_t = unsigned int]':
winrt/base.h:8163:49:   required from 'winrt::impl::hresult_type winrt::implements<D, I>::GetIids(winrt::impl::count_type*, winrt::impl::guid_type**) [with D = py::python_iterable<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >::iterator; I = {winrt::Windows::Foundation::Collections::IIterator<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >}; winrt::impl::hresult_type = int; winrt::impl::count_type = unsigned int; winrt::impl::guid_type = winrt::guid]'
winrt/base.h:7197:34:   required from 'int32_t winrt::impl::produce_base<D, I, Enable>::GetIids(uint32_t*, winrt::guid**) [with D = py::python_iterable<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >::iterator; I = winrt::Windows::Foundation::Collections::IIterator<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >; Enable = void; int32_t = int; uint32_t = unsigned int]'
winrt/base.h:7195:27:   required from here
winrt/base.h:7573:35: error: 'this' pointer is null [-Werror=nonnull]
7573 |                 return this->outer()->GetIids(count, array);
    |                        ~~~~~~~~~~~^~
C:/Users/david/Documents/GitHub/pywinrt/projection/winrt-sdk/src/winrt_sdk/cppwinrt/winrt/base.h:1766:39: note: in a call to non-static member function 'virtual int32_t winrt::impl::abi<winrt::Windows::Foundation::IInspectable>::type::GetIids(uint32_t*, winrt::guid**)'
1766 |             virtual int32_t __stdcall GetIids(uint32_t* count, guid** ids) noexcept = 0;
    |                                       ^~~~~~~

Fixes: #1349

This removes `constexpr` from the `template <typename D, bool>`
implementation of `root_implements_composable_inner::outer()`.

This was causing `nonnull` warnings in GCC such as:

    winrt/base.h: In instantiation of 'int32_t winrt::impl::root_implements<D, I>::GetIids(uint32_t*, winrt::guid**) [with D = py::python_iterable<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >::iterator; I = {winrt::Windows::Foundation::Collections::IIterator<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >}; int32_t = int; uint32_t = unsigned int]':
    winrt/base.h:8163:49:   required from 'winrt::impl::hresult_type winrt::implements<D, I>::GetIids(winrt::impl::count_type*, winrt::impl::guid_type**) [with D = py::python_iterable<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >::iterator; I = {winrt::Windows::Foundation::Collections::IIterator<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >}; winrt::impl::hresult_type = int; winrt::impl::count_type = unsigned int; winrt::impl::guid_type = winrt::guid]'
    winrt/base.h:7197:34:   required from 'int32_t winrt::impl::produce_base<D, I, Enable>::GetIids(uint32_t*, winrt::guid**) [with D = py::python_iterable<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >::iterator; I = winrt::Windows::Foundation::Collections::IIterator<winrt::Windows::Foundation::Collections::IKeyValuePair<winrt::hstring, winrt::hstring> >; Enable = void; int32_t = int; uint32_t = unsigned int]'
    winrt/base.h:7195:27:   required from here
    winrt/base.h:7573:35: error: 'this' pointer is null [-Werror=nonnull]
    7573 |                 return this->outer()->GetIids(count, array);
        |                        ~~~~~~~~~~~^~
    C:/Users/david/Documents/GitHub/pywinrt/projection/winrt-sdk/src/winrt_sdk/cppwinrt/winrt/base.h:1766:39: note: in a call to non-static member function 'virtual int32_t winrt::impl::abi<winrt::Windows::Foundation::IInspectable>::type::GetIids(uint32_t*, winrt::guid**)'
    1766 |             virtual int32_t __stdcall GetIids(uint32_t* count, guid** ids) noexcept = 0;
        |                                       ^~~~~~~

Fixes: microsoft#1349
Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

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

Thanks!

@kennykerr kennykerr merged commit 23c4ced into microsoft:master Sep 2, 2023
@dlech dlech deleted the gcc-nonnull-fix branch September 2, 2023 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: -Werror=nonnull when compiling with GCC on MINGW32

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.