Skip to content

Commit

Permalink
Merge pull request #96 from NuiCpp/devel
Browse files Browse the repository at this point in the history
Fixed some clang_cl regressions.
  • Loading branch information
5cript authored Nov 5, 2023
2 parents 4a68f3c + 398e239 commit fa09119
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
12 changes: 11 additions & 1 deletion nui/src/nui/backend/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# include <gtk/gtk.h>
# include <libsoup/soup.h>
#elif defined(_WIN32)
# if defined(_MSC_VER) && defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wlanguage-extension-token"
# endif
#endif

#include <random>
Expand Down Expand Up @@ -94,7 +98,9 @@ namespace Nui
# include "mac_webview_config_from_window_options.ipp"
#elif defined(_WIN32)
# include <webview2_environment_options.hpp>
#ifndef _MSC_VER
# include <webview2_iids.h>
#endif
# include <wrl/event.h>
# include "environment_options_from_window_options.ipp"
constexpr static auto wakeUpMessage = WM_APP + 1;
Expand Down Expand Up @@ -687,4 +693,8 @@ namespace Nui
return impl_->pool.executor();
}
// #####################################################################################################################
}
}

#if defined(_MSC_VER) && defined(__clang__)
# pragma clang diagnostic pop
#endif
15 changes: 12 additions & 3 deletions nui/windows/weakreference.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
#ifndef __weakreference_h__
#define __weakreference_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#pragma once

#if defined(_MSC_VER) && defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
#endif

/* Forward Declarations */
Expand Down Expand Up @@ -81,6 +84,8 @@ extern "C" {
/* [in] */ __RPC__in REFIID riid,
/* [iid_is][out] */ __RPC__deref_out IInspectable * *objectReference) = 0;

virtual ~IWeakReference() = default;

template <typename T>
_At_(*objectReference, _When_(FAILED(return), _Null_))
_At_(*objectReference, _When_(SUCCEEDED(return), _Maybenull_)) HRESULT
Expand All @@ -89,7 +94,7 @@ extern "C" {
static_assert(
__is_base_of(IInspectable, T), "Only Windows Runtime interfaces can be resolved by weak reference");
return Resolve(__uuidof(T), (IInspectable**)objectReference);
}
}
};
} // extern C++
# else
Expand Down Expand Up @@ -238,4 +243,8 @@ extern "C" {
}
#endif

#if defined(_MSC_VER) && defined(__clang__)
# pragma clang diagnostic pop
#endif

#endif
12 changes: 12 additions & 0 deletions nui/windows/wrl/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#ifndef _WRL_CLIENT_H_
#define _WRL_CLIENT_H_

#pragma once

#if defined(_MSC_VER) && defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wlanguage-extension-token"
#endif

#include <stddef.h>
#include <unknwn.h>
#include <weakreference.h>
Expand Down Expand Up @@ -380,4 +387,9 @@ namespace ABI
}
}

#if defined(_MSC_VER) && defined(__clang__)
# pragma clang diagnostic pop
#endif


#endif
7 changes: 1 addition & 6 deletions nui/windows/wrl/implements.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ namespace Microsoft
template <typename T>
struct CloakedIid : T
{
#ifndef _MSC_VER
virtual ~CloakedIid() = default;
#endif
};

enum RuntimeClassType
Expand Down Expand Up @@ -212,11 +210,10 @@ namespace Microsoft
reinterpret_cast<void* volatile*>(&module_), this, nullptr) == nullptr &&
"The module was already instantiated");

SRWLOCK initSRWLOCK = SRWLOCK_INIT;
[[maybe_unused]] SRWLOCK initSRWLOCK = SRWLOCK_INIT;
__WRL_ASSERT__(
reinterpret_cast<SRWLOCK*>(&moduleLock_)->Ptr == initSRWLOCK.Ptr &&
"Different value for moduleLock_ than SRWLOCK_INIT");
(initSRWLOCK);
#else
module_ = this;
#endif
Expand Down Expand Up @@ -923,9 +920,7 @@ namespace Microsoft
riid, ppv, pRefDelegated);
}

#ifndef _MSC_VER
virtual ~ImplementsHelper() = default;
#endif

IUnknown* CastToUnknown() throw()
{
Expand Down
4 changes: 3 additions & 1 deletion nui/windows/wrl/patch.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

constexpr auto JSCRIPT_E_CANTEXECUTE = 0x89020001;
#ifndef JSCRIPT_E_CANTEXECUTE
constexpr auto JSCRIPT_E_CANTEXECUTE = 0x89020001;
#endif

0 comments on commit fa09119

Please sign in to comment.