Core - Upgrade to stdcpp20 (#5215)

* Core - Upgrade to stdcpp20

- Set NOMINMAX
- Change compiler options
- Fix compiler errors

---------

Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
This commit is contained in:
Alex Maitland
2026-02-21 14:48:13 +10:00
committed by GitHub
parent 1dd444bdf8
commit 7b9e24db55
22 changed files with 63 additions and 39 deletions
@@ -301,7 +301,7 @@ namespace CefSharp
frame->SendProcessMessage(CefProcessId::PID_BROWSER, uncaughtExceptionMessage);
}
JavascriptRootObjectWrapper^ CefAppUnmanagedWrapper::GetJsRootObjectWrapper(int browserId, CefString& frameId)
JavascriptRootObjectWrapper^ CefAppUnmanagedWrapper::GetJsRootObjectWrapper(int browserId, CefString frameId)
{
auto rootObjectWrappers = _jsRootObjectWrappersByFrameId;
@@ -85,7 +85,7 @@ namespace CefSharp
}
CefBrowserWrapper^ FindBrowserWrapper(int browserId);
JavascriptRootObjectWrapper^ GetJsRootObjectWrapper(int browserId, CefString& frameId);
JavascriptRootObjectWrapper^ GetJsRootObjectWrapper(int browserId, CefString frameId);
virtual DECL CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override;
virtual DECL void OnBrowserCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefDictionaryValue> extraInfo) override;
@@ -30,7 +30,7 @@ namespace CefSharp
MCefRefPtr<CefBrowser> _cefBrowser;
public:
CefBrowserWrapper(CefRefPtr<CefBrowser> cefBrowser)
CefBrowserWrapper(const CefRefPtr<CefBrowser> &cefBrowser)
{
_cefBrowser = cefBrowser.get();
BrowserId = cefBrowser->GetIdentifier();
@@ -154,7 +154,8 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -174,7 +175,8 @@
<PreprocessorDefinitions>_DEBUG;EXPORT;NETCOREAPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -194,7 +196,8 @@
<PreprocessorDefinitions>_DEBUG;EXPORT;NETCOREAPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -214,7 +217,8 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -232,7 +236,8 @@
<PreprocessorDefinitions>NDEBUG;EXPORT;NETCOREAPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -250,7 +255,8 @@
<PreprocessorDefinitions>NDEBUG;EXPORT;NETCOREAPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -111,7 +111,8 @@
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -129,7 +130,8 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -146,7 +148,8 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -161,7 +164,8 @@
<PreprocessorDefinitions>WIN32;NDEBUG;EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
+2
View File
@@ -10,6 +10,8 @@
#define DECL __declspec(dllimport)
#endif
#define NOMINMAX
#include <vector>
#include <include/cef_base.h>
@@ -19,7 +19,7 @@ namespace CefSharp
bool _disposed;
internal:
Browser(CefRefPtr<CefBrowser> &browser)
Browser(const CefRefPtr<CefBrowser> &browser)
: _browser(browser)
{
}
@@ -31,7 +31,7 @@ namespace CefSharp
bool _disposed;
internal:
Frame(CefRefPtr<CefFrame> &frame)
Frame(const CefRefPtr<CefFrame> &frame)
: _frame(frame), _parentFrame(nullptr),
_owningBrowser(nullptr), _syncRoot(gcnew Object())
{
@@ -16,6 +16,8 @@ namespace CefSharp.Core
public BrowserSettings(bool autoDispose) { }
public virtual bool AutoDispose { get { throw null; } }
public virtual uint BackgroundColor { get { throw null; } set { } }
public virtual CefSharp.CefState ChromeStatusBubble { get { throw null; } set { } }
public virtual CefSharp.CefState ChromeZoomBubble { get { throw null; } set { } }
public virtual string CursiveFontFamily { get { throw null; } set { } }
public virtual CefSharp.CefState Databases { get { throw null; } set { } }
public virtual string DefaultEncoding { get { throw null; } set { } }
@@ -40,8 +42,6 @@ namespace CefSharp.Core
public virtual CefSharp.CefState TabToLinks { get { throw null; } set { } }
public virtual CefSharp.CefState TextAreaResize { get { throw null; } set { } }
public virtual CefSharp.CefState WebGl { get { throw null; } set { } }
public virtual CefSharp.CefState ChromeStatusBubble { get { throw null; } set { } }
public virtual CefSharp.CefState ChromeZoomBubble { get { throw null; } set { } }
public virtual int WindowlessFrameRate { get { throw null; } set { } }
public void Dispose() { }
protected virtual void Dispose(bool A_0) { }
@@ -178,7 +178,8 @@
<PrecompiledHeaderFile>Stdafx.h</PrecompiledHeaderFile>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
@@ -212,7 +213,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PrecompiledHeaderFile>Stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
@@ -243,7 +245,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PrecompiledHeaderFile>Stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
@@ -273,7 +276,8 @@
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>libcef.lib;libcef_dll_wrapper.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -297,7 +301,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>libcef.lib;libcef_dll_wrapper.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -319,7 +324,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>libcef.lib;libcef_dll_wrapper.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -130,7 +130,8 @@
<PrecompiledHeaderFile>Stdafx.h</PrecompiledHeaderFile>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
@@ -161,7 +162,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PrecompiledHeaderFile>Stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
@@ -188,7 +190,8 @@
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glu32.lib;libcef.lib;libcef_dll_wrapper.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -209,7 +212,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glu32.lib;libcef.lib;libcef_dll_wrapper.lib;%(AdditionalDependencies)</AdditionalDependencies>
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CefSharp
MCefRefPtr<CefDragData> _wrappedDragData;
internal:
DragData(CefRefPtr<CefDragData> &dragData) :
DragData(const CefRefPtr<CefDragData> &dragData) :
_wrappedDragData(dragData)
{
IsReadOnly = dragData->IsReadOnly();
@@ -26,7 +26,7 @@ namespace CefSharp
double GetZoomLevelOnUI();
internal:
CefBrowserHostWrapper(CefRefPtr<CefBrowserHost> &browserHost) : _browserHost(browserHost)
CefBrowserHostWrapper(const CefRefPtr<CefBrowserHost> &browserHost) : _browserHost(browserHost)
{
}
@@ -20,7 +20,7 @@ namespace CefSharp
IBrowserHost^ _browserHost;
internal:
CefBrowserWrapper::CefBrowserWrapper(CefRefPtr<CefBrowser> &browser)
CefBrowserWrapper(const CefRefPtr<CefBrowser> &browser)
: _browser(browser), _browserHost(nullptr)
{
}
@@ -111,7 +111,7 @@ namespace CefSharp
{
ThrowIfDisposed();
std::vector<CefString>& dictionarySuggestions = std::vector<CefString>();
std::vector<CefString> dictionarySuggestions;
bool result = _wrappedInfo->GetDictionarySuggestions(dictionarySuggestions);
return StringUtils::ToClr(dictionarySuggestions);
@@ -32,7 +32,7 @@ namespace CefSharp
Object^ _syncRoot;
internal:
CefFrameWrapper::CefFrameWrapper(CefRefPtr<CefFrame> &frame)
CefFrameWrapper(const CefRefPtr<CefFrame> &frame)
: _frame(frame), _parentFrame(nullptr),
_owningBrowser(nullptr), _syncRoot(gcnew Object())
{
@@ -21,7 +21,7 @@ namespace CefSharp
internal:
MCefRefPtr<CefImage> _image;
CefImageWrapper::CefImageWrapper(CefRefPtr<CefImage> &image)
CefImageWrapper(const CefRefPtr<CefImage> &image)
: _image(image)
{
}
@@ -19,7 +19,7 @@ namespace CefSharp
{
MCefRefPtr<CefResponse> _response;
internal:
CefResponseWrapper(CefRefPtr<CefResponse> &response) :
CefResponseWrapper(const CefRefPtr<CefResponse> &response) :
_response(response)
{
@@ -53,7 +53,7 @@ namespace CefSharp
}
internal:
CefValueWrapper(CefRefPtr<CefValue> &cefValue) : _cefValue(cefValue)
CefValueWrapper(const CefRefPtr<CefValue> &cefValue) : _cefValue(cefValue)
{
}
@@ -26,7 +26,7 @@ namespace CefSharp
/// <param name="cefStr">The string that should be converted.</param>
/// <returns>A .NET string.</returns>
[DebuggerStepThrough]
static String^ StringUtils::ToClr(const cef_string_t& cefStr)
static String^ ToClr(const cef_string_t& cefStr)
{
auto str = reinterpret_cast<wchar_t*>(cefStr.str);
@@ -39,7 +39,7 @@ namespace CefSharp
/// <param name="cefStr">The string that should be converted.</param>
/// <returns>A .NET string.</returns>
[DebuggerStepThrough]
static String^ StringUtils::ToClr(const CefString& cefStr)
static String^ ToClr(const CefString& cefStr)
{
auto str = reinterpret_cast<const wchar_t*>(cefStr.c_str());
@@ -112,7 +112,7 @@ namespace CefSharp
/// <param name="cefStr">The cef_string_t that should be updated.</param>
/// <param name="str">The .NET string whose value should be used to update cefStr.</param>
[DebuggerStepThrough]
static void StringUtils::AssignNativeFromClr(cef_string_t& cefStr, String^ str)
static void AssignNativeFromClr(cef_string_t& cefStr, String^ str)
{
cef_string_clear(&cefStr);
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CefSharp
RequestContextSettings^ _settings;
internal:
RequestContext(CefRefPtr<CefRequestContext>& context)
RequestContext(const CefRefPtr<CefRequestContext>& context)
{
_requestContext = context.get();
_settings = nullptr;
+2
View File
@@ -10,6 +10,8 @@
#define DECL __declspec(dllimport)
#endif
#define NOMINMAX
#include <vector>
#include <list>