From 550f1bf519f0a5219d67d3800ca3cf014ee762ae Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Fri, 14 Apr 2023 23:55:53 -0500 Subject: [PATCH 1/5] Embrace nullptr over NULL and 0 --- Source/Core/Common/GL/GLInterface/GLX.cpp | 6 ++++-- Source/Core/Common/MemoryUtil.cpp | 2 +- Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp | 2 +- Source/Core/Core/PowerPC/GDBStub.cpp | 2 +- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 8 ++++---- Source/Core/DolphinQt/QtUtils/FlowLayout.cpp | 4 ++-- Source/Core/DolphinQt/QtUtils/WinIconHelper.cpp | 2 +- Source/Core/DolphinQt/Settings/GameCubePane.cpp | 4 ++-- Source/Core/DolphinQt/ToolBar.cpp | 4 ++-- Source/Core/UICommon/Disassembler.cpp | 3 ++- Source/Core/UICommon/ResourcePack/ResourcePack.cpp | 4 ++-- Source/Core/VideoBackends/D3D12/DX12Context.cpp | 2 +- Source/Core/VideoBackends/OGL/OGLTexture.cpp | 10 +++++----- Source/Core/VideoBackends/OGL/OGLTexture.h | 2 +- Source/Core/WinUpdater/Main.cpp | 2 +- Source/Core/WinUpdater/WinUI.cpp | 12 ++++++------ 16 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Source/Core/Common/GL/GLInterface/GLX.cpp b/Source/Core/Common/GL/GLInterface/GLX.cpp index b04296d0968f..ce16bb21553b 100644 --- a/Source/Core/Common/GL/GLInterface/GLX.cpp +++ b/Source/Core/Common/GL/GLInterface/GLX.cpp @@ -155,7 +155,8 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, None}}; s_glxError = false; - m_context = glXCreateContextAttribs(m_display, m_fbconfig, 0, True, &context_attribs[0]); + m_context = + glXCreateContextAttribs(m_display, m_fbconfig, nullptr, True, &context_attribs[0]); XSync(m_display, False); if (!m_context || s_glxError) continue; @@ -174,7 +175,8 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor std::array context_attribs_legacy = { {GLX_CONTEXT_MAJOR_VERSION_ARB, 1, GLX_CONTEXT_MINOR_VERSION_ARB, 0, None}}; s_glxError = false; - m_context = glXCreateContextAttribs(m_display, m_fbconfig, 0, True, &context_attribs_legacy[0]); + m_context = + glXCreateContextAttribs(m_display, m_fbconfig, nullptr, True, &context_attribs_legacy[0]); XSync(m_display, False); m_attribs.clear(); m_attribs.insert(m_attribs.end(), context_attribs_legacy.begin(), context_attribs_legacy.end()); diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp index f94af858222f..b473705411be 100644 --- a/Source/Core/Common/MemoryUtil.cpp +++ b/Source/Core/Common/MemoryUtil.cpp @@ -250,7 +250,7 @@ size_t MemPhysical() mib[1] = HW_PHYSMEM64; #endif size_t length = sizeof(size_t); - sysctl(mib, 2, &physical_memory, &length, NULL, 0); + sysctl(mib, 2, &physical_memory, &length, nullptr, 0); return physical_memory; #elif defined __HAIKU__ system_info sysinfo; diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp index 62e8ec2987ca..4d147b1d3baf 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp @@ -103,7 +103,7 @@ std::optional USB_HIDv4::GetDeviceChange(const IOCtlRequest& request) IPCReply USB_HIDv4::Shutdown(const IOCtlRequest& request) { std::lock_guard lk{m_devicechange_hook_address_mutex}; - if (m_devicechange_hook_request != 0) + if (m_devicechange_hook_request) { auto& system = Core::System::GetInstance(); auto& memory = system.GetMemory(); diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index 99cdae0ce047..d88d6a06b06d 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -1052,7 +1052,7 @@ void InitLocal(const char* socket) addr.sun_family = AF_UNIX; strcpy(addr.sun_path, socket); - InitGeneric(PF_LOCAL, (const sockaddr*)&addr, sizeof(addr), NULL, NULL); + InitGeneric(PF_LOCAL, (const sockaddr*)&addr, sizeof(addr), nullptr, nullptr); } #endif diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index a34ace70ce18..4b5e5aa1ef88 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -62,12 +62,12 @@ bool PlatformWin32::RegisterRenderWindowClass() wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = GetModuleHandle(nullptr); - wc.hIcon = LoadIcon(NULL, IDI_ICON1); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hIcon = LoadIcon(nullptr, IDI_ICON1); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wc.lpszMenuName = NULL; + wc.lpszMenuName = nullptr; wc.lpszClassName = WINDOW_CLASS_NAME; - wc.hIconSm = LoadIcon(NULL, IDI_ICON1); + wc.hIconSm = LoadIcon(nullptr, IDI_ICON1); if (!RegisterClassEx(&wc)) { diff --git a/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp b/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp index 5ef3e0aa08fe..b2c4eb75d59d 100644 --- a/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp +++ b/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp @@ -75,7 +75,7 @@ QLayoutItem* FlowLayout::takeAt(int index) if (index >= 0 && index < m_item_list.size()) return m_item_list.takeAt(index); else - return 0; + return nullptr; } Qt::Orientations FlowLayout::expandingDirections() const @@ -167,7 +167,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const else if (parent->isWidgetType()) { QWidget* pw = static_cast(parent); - return pw->style()->pixelMetric(pm, 0, pw); + return pw->style()->pixelMetric(pm, nullptr, pw); } else { diff --git a/Source/Core/DolphinQt/QtUtils/WinIconHelper.cpp b/Source/Core/DolphinQt/QtUtils/WinIconHelper.cpp index f1c39a4c09be..7dc558371b99 100644 --- a/Source/Core/DolphinQt/QtUtils/WinIconHelper.cpp +++ b/Source/Core/DolphinQt/QtUtils/WinIconHelper.cpp @@ -42,7 +42,7 @@ static QPixmap PixmapFromHICON(HICON icon) const int h = iconinfo.yHotspot * 2; BITMAPINFO bitmapInfo = GetBMI(w, h, false); DWORD* bits; - HBITMAP winBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (VOID**)&bits, NULL, 0); + HBITMAP winBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (VOID**)&bits, nullptr, 0); HGDIOBJ oldhdc = reinterpret_cast(SelectObject(hdc, winBitmap)); DrawIconEx(hdc, 0, 0, icon, iconinfo.xHotspot * 2, iconinfo.yHotspot * 2, 0, 0, DI_NORMAL); diff --git a/Source/Core/DolphinQt/Settings/GameCubePane.cpp b/Source/Core/DolphinQt/Settings/GameCubePane.cpp index 55510fd9f94f..a19fce31fbae 100644 --- a/Source/Core/DolphinQt/Settings/GameCubePane.cpp +++ b/Source/Core/DolphinQt/Settings/GameCubePane.cpp @@ -410,7 +410,7 @@ void GameCubePane::BrowseMemcard(ExpansionInterface::Slot slot) const QString filename = DolphinFileDialog::getSaveFileName( this, tr("Choose a file to open or create"), QString::fromStdString(File::GetUserPath(D_GCUSER_IDX)), - tr("GameCube Memory Cards (*.raw *.gcp)"), 0, QFileDialog::DontConfirmOverwrite); + tr("GameCube Memory Cards (*.raw *.gcp)"), nullptr, QFileDialog::DontConfirmOverwrite); if (!filename.isEmpty()) SetMemcard(slot, filename); @@ -618,7 +618,7 @@ void GameCubePane::BrowseAGPRom(ExpansionInterface::Slot slot) QString filename = DolphinFileDialog::getSaveFileName( this, tr("Choose a file to open"), QString::fromStdString(File::GetUserPath(D_GCUSER_IDX)), - tr("Game Boy Advance Carts (*.gba)"), 0, QFileDialog::DontConfirmOverwrite); + tr("Game Boy Advance Carts (*.gba)"), nullptr, QFileDialog::DontConfirmOverwrite); if (!filename.isEmpty()) SetAGPRom(slot, filename); diff --git a/Source/Core/DolphinQt/ToolBar.cpp b/Source/Core/DolphinQt/ToolBar.cpp index 49f384848d72..b50e48bf9eac 100644 --- a/Source/Core/DolphinQt/ToolBar.cpp +++ b/Source/Core/DolphinQt/ToolBar.cpp @@ -154,14 +154,14 @@ void ToolBar::UpdatePausePlayButtonState(const bool playing_state) { if (playing_state) { - disconnect(m_pause_play_action, 0, 0, 0); + disconnect(m_pause_play_action, nullptr, nullptr, nullptr); m_pause_play_action->setText(tr("Pause")); m_pause_play_action->setIcon(Resources::GetScaledThemeIcon("pause")); connect(m_pause_play_action, &QAction::triggered, this, &ToolBar::PausePressed); } else { - disconnect(m_pause_play_action, 0, 0, 0); + disconnect(m_pause_play_action, nullptr, nullptr, nullptr); m_pause_play_action->setText(tr("Play")); m_pause_play_action->setIcon(Resources::GetScaledThemeIcon("play")); connect(m_pause_play_action, &QAction::triggered, this, &ToolBar::PlayPressed); diff --git a/Source/Core/UICommon/Disassembler.cpp b/Source/Core/UICommon/Disassembler.cpp index 840af8ec1fa2..a4cd3ad34434 100644 --- a/Source/Core/UICommon/Disassembler.cpp +++ b/Source/Core/UICommon/Disassembler.cpp @@ -47,7 +47,8 @@ HostDisassemblerLLVM::HostDisassemblerLLVM(const std::string& host_disasm, int i LLVMInitializeAllTargetMCs(); LLVMInitializeAllDisassemblers(); - m_llvm_context = LLVMCreateDisasmCPU(host_disasm.c_str(), cpu.c_str(), nullptr, 0, 0, nullptr); + m_llvm_context = + LLVMCreateDisasmCPU(host_disasm.c_str(), cpu.c_str(), nullptr, 0, nullptr, nullptr); // Couldn't create llvm context if (!m_llvm_context) diff --git a/Source/Core/UICommon/ResourcePack/ResourcePack.cpp b/Source/Core/UICommon/ResourcePack/ResourcePack.cpp index 355dc8acf2b5..7f670e774828 100644 --- a/Source/Core/UICommon/ResourcePack/ResourcePack.cpp +++ b/Source/Core/UICommon/ResourcePack/ResourcePack.cpp @@ -36,7 +36,7 @@ ResourcePack::ResourcePack(const std::string& path) : m_path(path) return; } - if (unzLocateFile(file, "manifest.json", 0) == UNZ_END_OF_LIST_OF_FILE) + if (unzLocateFile(file, "manifest.json", nullptr) == UNZ_END_OF_LIST_OF_FILE) { m_valid = false; m_error = "Resource pack is missing a manifest."; @@ -63,7 +63,7 @@ ResourcePack::ResourcePack(const std::string& path) : m_path(path) return; } - if (unzLocateFile(file, "logo.png", 0) != UNZ_END_OF_LIST_OF_FILE) + if (unzLocateFile(file, "logo.png", nullptr) != UNZ_END_OF_LIST_OF_FILE) { unz_file_info64 logo_info{}; unzGetCurrentFileInfo64(file, &logo_info, nullptr, 0, nullptr, 0, nullptr, 0); diff --git a/Source/Core/VideoBackends/D3D12/DX12Context.cpp b/Source/Core/VideoBackends/D3D12/DX12Context.cpp index 8343e39a6ec2..19a13f64b4f3 100644 --- a/Source/Core/VideoBackends/D3D12/DX12Context.cpp +++ b/Source/Core/VideoBackends/D3D12/DX12Context.cpp @@ -221,7 +221,7 @@ bool DXContext::CreateFence() return false; m_fence_event = CreateEvent(nullptr, FALSE, FALSE, nullptr); - ASSERT_MSG(VIDEO, m_fence_event != NULL, "Failed to create fence event"); + ASSERT_MSG(VIDEO, m_fence_event != nullptr, "Failed to create fence event"); if (!m_fence_event) return false; diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.cpp b/Source/Core/VideoBackends/OGL/OGLTexture.cpp index ad0e32bb390e..4e90211c59f3 100644 --- a/Source/Core/VideoBackends/OGL/OGLTexture.cpp +++ b/Source/Core/VideoBackends/OGL/OGLTexture.cpp @@ -296,7 +296,7 @@ OGLStagingTexture::OGLStagingTexture(StagingTextureType type, const TextureConfi OGLStagingTexture::~OGLStagingTexture() { - if (m_fence != 0) + if (m_fence != nullptr) glDeleteSync(m_fence); if (m_map_pointer) { @@ -418,7 +418,7 @@ void OGLStagingTexture::CopyFromTexture(const AbstractTexture* src, // If we support buffer storage, create a fence for synchronization. if (UsePersistentStagingBuffers()) { - if (m_fence != 0) + if (m_fence != nullptr) glDeleteSync(m_fence); glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); @@ -479,7 +479,7 @@ void OGLStagingTexture::CopyToTexture(const MathUtil::Rectangle& src_rect, // If we support buffer storage, create a fence for synchronization. if (UsePersistentStagingBuffers()) { - if (m_fence != 0) + if (m_fence != nullptr) glDeleteSync(m_fence); m_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); @@ -493,7 +493,7 @@ void OGLStagingTexture::Flush() { // No-op when not using buffer storage, as the transfers happen on Map(). // m_fence will always be zero in this case. - if (m_fence == 0) + if (m_fence == nullptr) { m_needs_flush = false; return; @@ -501,7 +501,7 @@ void OGLStagingTexture::Flush() glClientWaitSync(m_fence, 0, GL_TIMEOUT_IGNORED); glDeleteSync(m_fence); - m_fence = 0; + m_fence = nullptr; m_needs_flush = false; } diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.h b/Source/Core/VideoBackends/OGL/OGLTexture.h index 9d1c11950597..f80aa98725a8 100644 --- a/Source/Core/VideoBackends/OGL/OGLTexture.h +++ b/Source/Core/VideoBackends/OGL/OGLTexture.h @@ -75,7 +75,7 @@ class OGLStagingTexture final : public AbstractStagingTexture GLenum m_target; GLuint m_buffer_name; size_t m_buffer_size; - GLsync m_fence = 0; + GLsync m_fence = nullptr; }; class OGLFramebuffer final : public AbstractFramebuffer diff --git a/Source/Core/WinUpdater/Main.cpp b/Source/Core/WinUpdater/Main.cpp index 6b7fd801efd3..66fc5216712e 100644 --- a/Source/Core/WinUpdater/Main.cpp +++ b/Source/Core/WinUpdater/Main.cpp @@ -58,7 +58,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine } // Relaunch the updater as administrator - ShellExecuteW(nullptr, L"runas", path->c_str(), pCmdLine, NULL, SW_SHOW); + ShellExecuteW(nullptr, L"runas", path->c_str(), pCmdLine, nullptr, SW_SHOW); return 0; } diff --git a/Source/Core/WinUpdater/WinUI.cpp b/Source/Core/WinUpdater/WinUI.cpp index 418764813b82..696ac55b0a15 100644 --- a/Source/Core/WinUpdater/WinUI.cpp +++ b/Source/Core/WinUpdater/WinUI.cpp @@ -77,7 +77,7 @@ bool InitWindow() if (!window_handle) return false; - if (SUCCEEDED(CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, + if (SUCCEEDED(CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(taskbar_list.GetAddressOf())))) { if (FAILED(taskbar_list->HrInit())) @@ -88,8 +88,8 @@ bool InitWindow() int y = PADDING_HEIGHT; - label_handle = CreateWindow(L"STATIC", NULL, WS_VISIBLE | WS_CHILD, 5, y, 500, 25, window_handle, - nullptr, nullptr, 0); + label_handle = CreateWindow(L"STATIC", nullptr, WS_VISIBLE | WS_CHILD, 5, y, 500, 25, + window_handle, nullptr, nullptr, 0); if (!label_handle) return false; @@ -106,7 +106,7 @@ bool InitWindow() y += GetWindowHeight(label_handle) + PADDING_HEIGHT; - total_progressbar_handle = CreateWindow(PROGRESS_CLASS, NULL, PROGRESSBAR_FLAGS, 5, y, 470, 25, + total_progressbar_handle = CreateWindow(PROGRESS_CLASS, nullptr, PROGRESSBAR_FLAGS, 5, y, 470, 25, window_handle, nullptr, nullptr, 0); y += GetWindowHeight(total_progressbar_handle) + PADDING_HEIGHT; @@ -114,8 +114,8 @@ bool InitWindow() if (!total_progressbar_handle) return false; - current_progressbar_handle = CreateWindow(PROGRESS_CLASS, NULL, PROGRESSBAR_FLAGS, 5, y, 470, 25, - window_handle, nullptr, nullptr, 0); + current_progressbar_handle = CreateWindow(PROGRESS_CLASS, nullptr, PROGRESSBAR_FLAGS, 5, y, 470, + 25, window_handle, nullptr, nullptr, 0); y += GetWindowHeight(current_progressbar_handle) + PADDING_HEIGHT; From f3dd4ba35fb46ea584cce1692e54d1080b52647c Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Fri, 24 Mar 2023 17:17:18 -0500 Subject: [PATCH 2/5] Resolve [-Wzero-as-null-pointer-constant] in Source --- Source/CMakeLists.txt | 2 +- Source/Core/Common/FatFsUtil.cpp | 16 ++++++++++++++++ Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp | 7 +++++++ Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 7 +++++++ Source/Core/Core/IOS/USB/Host.cpp | 7 +++++++ Source/Core/Core/IOS/USB/LibusbDevice.cpp | 7 +++++++ Source/Core/Core/LibusbUtils.cpp | 7 +++++++ Source/Core/Core/PowerPC/Expression.cpp | 7 +++++++ Source/Core/InputCommon/GCAdapter.cpp | 7 +++++++ Source/Core/UICommon/USBUtils.cpp | 7 +++++++ 10 files changed, 73 insertions(+), 1 deletion(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 4a4cd61b5133..b23aeb9d3edc 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -34,7 +34,7 @@ else() #check_and_add_flag(SWITCH_DEFAULT -Wswitch-default) #check_and_add_flag(FLOAT_EQUAL -Wfloat-equal) #check_and_add_flag(CONVERSION -Wconversion) - #check_and_add_flag(ZERO_AS_NULL_POINTER_CONSTANT -Wzero-as-null-pointer-constant) + check_and_add_flag(ZERO_AS_NULL_POINTER_CONSTANT -Wzero-as-null-pointer-constant) check_and_add_flag(TYPE_LIMITS -Wtype-limits) check_and_add_flag(SIGN_COMPARE -Wsign-compare) check_and_add_flag(IGNORED_QUALIFIERS -Wignored-qualifiers) diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index f194dc22a3cc..395d6ac3eb6f 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -571,7 +571,15 @@ bool SyncSDFolderToSDImage(const std::function& cancelled, bool determin FatFsErrorToString(mount_error_code)); return false; } + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif Common::ScopeGuard unmount_guard{[] { f_unmount(""); }}; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif if (!Pack(cancelled, root, true, tmp_buffer)) { @@ -795,7 +803,15 @@ bool SyncSDImageToSDFolder(const std::function& cancelled) FatFsErrorToString(mount_error_code)); return false; } + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif Common::ScopeGuard unmount_guard{[] { f_unmount(""); }}; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // Unpack() and GetTempFilenameForAtomicWrite() don't want the trailing separator. const std::string target_dir_without_slash = target_dir.substr(0, target_dir.length() - 1); diff --git a/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp b/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp index 16ba1b1ad78a..f8e87c0bfac9 100644 --- a/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp +++ b/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp @@ -294,7 +294,14 @@ ErrorCode OpenVFF(const std::string& path, const std::string& filename, return; } +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif Common::ScopeGuard unmount_guard{[] { f_unmount(""); }}; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif const auto write_error_code = WriteFile(filename, data); if (write_error_code != WC24_OK) diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 72f591c7f576..2edb6bf0c41d 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -16,7 +16,14 @@ #include #include +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #include "Common/ChunkFile.h" #include "Common/Logging/Log.h" diff --git a/Source/Core/Core/IOS/USB/Host.cpp b/Source/Core/Core/IOS/USB/Host.cpp index 8870f730b058..5f4d3208efc3 100644 --- a/Source/Core/Core/IOS/USB/Host.cpp +++ b/Source/Core/Core/IOS/USB/Host.cpp @@ -11,7 +11,14 @@ #include #ifdef __LIBUSB__ +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #endif #include "Common/Assert.h" diff --git a/Source/Core/Core/IOS/USB/LibusbDevice.cpp b/Source/Core/Core/IOS/USB/LibusbDevice.cpp index 9e305b917981..0b01c0ddd372 100644 --- a/Source/Core/Core/IOS/USB/LibusbDevice.cpp +++ b/Source/Core/Core/IOS/USB/LibusbDevice.cpp @@ -13,7 +13,14 @@ #include #include +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #include "Common/Assert.h" #include "Common/Logging/Log.h" diff --git a/Source/Core/Core/LibusbUtils.cpp b/Source/Core/Core/LibusbUtils.cpp index 1b1852dddd11..7eb628b09b88 100644 --- a/Source/Core/Core/LibusbUtils.cpp +++ b/Source/Core/Core/LibusbUtils.cpp @@ -7,7 +7,14 @@ #include #if defined(__LIBUSB__) +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #endif #include "Common/Assert.h" diff --git a/Source/Core/Core/PowerPC/Expression.cpp b/Source/Core/Core/PowerPC/Expression.cpp index 2fe2d8c036ed..06004a9029ea 100644 --- a/Source/Core/Core/PowerPC/Expression.cpp +++ b/Source/Core/Core/PowerPC/Expression.cpp @@ -11,7 +11,14 @@ #include #include +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #include "Common/BitUtils.h" #include "Common/CommonTypes.h" diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index a3853e9e6cf3..7780d486dd3c 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -17,7 +17,14 @@ #include #if GCADAPTER_USE_LIBUSB_IMPLEMENTATION +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #elif GCADAPTER_USE_ANDROID_IMPLEMENTATION #include #endif diff --git a/Source/Core/UICommon/USBUtils.cpp b/Source/Core/UICommon/USBUtils.cpp index 2264afe82cca..f86dbb7169ba 100644 --- a/Source/Core/UICommon/USBUtils.cpp +++ b/Source/Core/UICommon/USBUtils.cpp @@ -7,7 +7,14 @@ #include #ifdef __LIBUSB__ +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif #include +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #endif #include "Common/CommonTypes.h" From 97e307fdb80285bc1fdbebbd3d1cb2d255a50fef Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:08:50 -0500 Subject: [PATCH 3/5] Include externals as system headers --- CMakeLists.txt | 108 ++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c702c69dce9d..5db82e1f0655 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -470,7 +470,7 @@ endif() if(ENABLE_VTUNE) set(VTUNE_DIR "/opt/intel/vtune_amplifier") add_definitions(-DUSE_VTUNE) - include_directories("${VTUNE_DIR}/include") + include_directories(SYSTEM "${VTUNE_DIR}/include") set(VTUNE_LIBRARIES "${VTUNE_DIR}/lib64/libjitprofiling.a" "${VTUNE_DIR}/lib64/libittnotify.a" @@ -533,7 +533,7 @@ set(OpenGL_GL_PREFERENCE GLVND CACHE STRING "Linux-only: if GLVND, use the vendo set_property(CACHE OpenGL_GL_PREFERENCE PROPERTY STRINGS GLVND LEGACY) find_package(OpenGL) if (OPENGL_GL) - include_directories(${OPENGL_INCLUDE_DIR}) + include_directories(SYSTEM ${OPENGL_INCLUDE_DIR}) endif() if(ENABLE_X11) @@ -636,7 +636,7 @@ if(ENABLE_SDL) set(SDL_TEST OFF) set(SDL_TEST_ENABLED_BY_DEFAULT OFF) set(OPT_DEF_LIBC ON) - add_subdirectory(Externals/SDL/SDL) + add_subdirectory(Externals/SDL/SDL SYSTEM) if (TARGET SDL2) dolphin_disable_warnings_msvc(SDL2) endif() @@ -682,9 +682,9 @@ endif() # Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory) # if (_M_X86) - add_subdirectory(Externals/Bochs_disasm) + add_subdirectory(Externals/Bochs_disasm SYSTEM) endif() -add_subdirectory(Externals/cpp-optparse) +add_subdirectory(Externals/cpp-optparse SYSTEM) find_package(fmt 8) if(fmt_FOUND) @@ -692,22 +692,22 @@ if(fmt_FOUND) else() check_vendoring_approved(fmt) message(STATUS "Using static fmt from Externals") - add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL) + add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL SYSTEM) endif() -add_subdirectory(Externals/imgui) -add_subdirectory(Externals/implot) -add_subdirectory(Externals/glslang) +add_subdirectory(Externals/imgui SYSTEM) +add_subdirectory(Externals/implot SYSTEM) +add_subdirectory(Externals/glslang SYSTEM) # SPIRV-Cross is used on Windows for GLSL to HLSL conversion for the Direct3D 11 and Direct3D 12 # video backends, and on Apple devices for the Metal video backend. if(WIN32 OR APPLE) - add_subdirectory(Externals/spirv_cross) + add_subdirectory(Externals/spirv_cross SYSTEM) endif() if(ENABLE_VULKAN) add_definitions(-DHAS_VULKAN) if(APPLE AND USE_BUNDLED_MOLTENVK) - add_subdirectory(Externals/MoltenVK) + add_subdirectory(Externals/MoltenVK SYSTEM) endif() endif() @@ -720,7 +720,7 @@ find_package(pugixml) if(NOT pugixml_FOUND) check_vendoring_approved(pugixml) message(STATUS "Using static pugixml from Externals") - add_subdirectory(Externals/pugixml) + add_subdirectory(Externals/pugixml SYSTEM) endif() if(USE_SHARED_ENET) @@ -747,13 +747,13 @@ if (ENET_FOUND) else() check_vendoring_approved(enet) message(STATUS "Using static enet from Externals") - include_directories(Externals/enet/include) - add_subdirectory(Externals/enet) + include_directories(SYSTEM Externals/enet/include) + add_subdirectory(Externals/enet SYSTEM) endif() if(NOT XXHASH_FOUND) message(STATUS "Using static xxhash from Externals") - add_subdirectory(Externals/xxhash) + add_subdirectory(Externals/xxhash SYSTEM) endif() find_package(BZip2) @@ -762,7 +762,7 @@ if(BZIP2_FOUND) else() check_vendoring_approved(bzip2) message(STATUS "Shared bzip2 not found, falling back to the static library") - add_subdirectory(Externals/bzip2) + add_subdirectory(Externals/bzip2 SYSTEM) endif() # macOS ships with liblzma.dylib but no headers, so check for the headers too @@ -774,7 +774,7 @@ if(LIBLZMA_FOUND) else() check_vendoring_approved(lzma) message(STATUS "Shared lzma not found, falling back to the static library") - add_subdirectory(Externals/liblzma) + add_subdirectory(Externals/liblzma SYSTEM) endif() pkg_check_modules(ZSTD QUIET libzstd>=1.4.0 IMPORTED_TARGET) @@ -784,20 +784,20 @@ if(ZSTD_FOUND) else() check_vendoring_approved(zstd) message(STATUS "Shared zstd not found, falling back to the static library") - add_subdirectory(Externals/zstd) + add_subdirectory(Externals/zstd SYSTEM) endif() -add_subdirectory(Externals/zlib-ng) +add_subdirectory(Externals/zlib-ng SYSTEM) pkg_check_modules(MINIZIP minizip>=3.0.0) if(MINIZIP_FOUND) message(STATUS "Using shared minizip") - include_directories(${MINIZIP_INCLUDE_DIRS}) + include_directories(SYSTEM ${MINIZIP_INCLUDE_DIRS}) else() check_vendoring_approved(minizip) message(STATUS "Shared minizip not found, falling back to the static library") - add_subdirectory(Externals/minizip) - include_directories(External/minizip) + add_subdirectory(Externals/minizip SYSTEM) + include_directories(SYSTEM External/minizip) endif() if(NOT APPLE) @@ -808,7 +808,7 @@ if(LZO_FOUND) else() check_vendoring_approved(lzo) message(STATUS "Using static lzo from Externals") - add_subdirectory(Externals/LZO) + add_subdirectory(Externals/LZO SYSTEM) set(LZO lzo2) endif() @@ -818,25 +818,25 @@ if (pc_spng_FOUND AND TARGET PkgConfig::pc_spng) set(spng_target PkgConfig::pc_spng) else() message(STATUS "Using static libspng from Externals") - add_subdirectory(Externals/libspng) + add_subdirectory(Externals/libspng SYSTEM) set(spng_target spng) endif() # Using static FreeSurround from Externals # There is no system FreeSurround library. message(STATUS "Using static FreeSurround from Externals") -add_subdirectory(Externals/FreeSurround) +add_subdirectory(Externals/FreeSurround SYSTEM) if (APPLE OR WIN32) message(STATUS "Using ed25519 from Externals") - add_subdirectory(Externals/ed25519) - include_directories(Externals/ed25519) + add_subdirectory(Externals/ed25519 SYSTEM) + include_directories(SYSTEM Externals/ed25519) endif() # Using static soundtouch from Externals # Unable to use system soundtouch library: We require shorts, not floats. -add_subdirectory(Externals/soundtouch) -include_directories(Externals/soundtouch) +add_subdirectory(Externals/soundtouch SYSTEM) +include_directories(SYSTEM Externals/soundtouch) find_package(CUBEB) if(CUBEB_FOUND) @@ -844,7 +844,7 @@ if(CUBEB_FOUND) else() check_vendoring_approved(cubeb) message(STATUS "Using static cubeb from Externals") - add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL) + add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL SYSTEM) endif() if(NOT ANDROID) @@ -854,11 +854,11 @@ if(NOT ANDROID) endif() if(LIBUSB_FOUND AND NOT APPLE) message(STATUS "Using shared LibUSB") - include_directories(${LIBUSB_INCLUDE_DIR}) + include_directories(SYSTEM ${LIBUSB_INCLUDE_DIR}) else() check_vendoring_approved(libusb) message(STATUS "Using static LibUSB from Externals") - add_subdirectory(Externals/libusb) + add_subdirectory(Externals/libusb SYSTEM) set(LIBUSB_LIBRARIES usb) endif() set(LIBUSB_FOUND true) @@ -874,8 +874,8 @@ else() check_vendoring_approved(sfml) message(STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals") add_definitions(-DSFML_STATIC) - add_subdirectory(Externals/SFML) - include_directories(BEFORE Externals/SFML/include) + add_subdirectory(Externals/SFML SYSTEM) + include_directories(BEFORE SYSTEM Externals/SFML/include) endif() if(USE_UPNP) @@ -887,7 +887,7 @@ if(USE_UPNP) else() check_vendoring_approved(miniupnpc) message(STATUS "Using static miniupnpc from Externals") - add_subdirectory(Externals/miniupnpc) + add_subdirectory(Externals/miniupnpc SYSTEM) endif() add_definitions(-DUSE_UPNP) endif() @@ -897,25 +897,25 @@ if(NOT APPLE) endif() if(MBEDTLS_FOUND) message(STATUS "Using shared mbed TLS") - include_directories(${MBEDTLS_INCLUDE_DIRS}) + include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS}) else() check_vendoring_approved(mbedtls) message(STATUS "Using static mbed TLS from Externals") set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509) - add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL) - include_directories(Externals/mbedtls/include) + add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL SYSTEM) + include_directories(SYSTEM Externals/mbedtls/include) endif() find_package(CURL) if(CURL_FOUND) message(STATUS "Using shared libcurl") - include_directories(${CURL_INCLUDE_DIRS}) + include_directories(SYSTEM ${CURL_INCLUDE_DIRS}) else() check_vendoring_approved(curl) message(STATUS "Using static libcurl from Externals") - add_subdirectory(Externals/curl) + add_subdirectory(Externals/curl SYSTEM) set(CURL_LIBRARIES curl) - include_directories(BEFORE Externals/curl/include) + include_directories(BEFORE SYSTEM Externals/curl/include) endif() if (NOT ANDROID) @@ -928,8 +928,8 @@ if (NOT ANDROID AND ICONV_LIBRARIES AND ICONV_INCLUDE_DIR) else() check_vendoring_approved(iconv) message(STATUS "Using static iconv from Externals") - include_directories(Externals/libiconv-1.14/include) - add_subdirectory(Externals/libiconv-1.14) + include_directories(SYSTEM Externals/libiconv-1.14/include) + add_subdirectory(Externals/libiconv-1.14 SYSTEM) set(ICONV_LIBRARIES iconv) endif() @@ -938,14 +938,14 @@ if(NOT ANDROID) if(NOT HIDAPI_FOUND) check_vendoring_approved(hidapi) message(STATUS "Using static HIDAPI from Externals") - add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL) + add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL SYSTEM) endif() endif() if(USE_DISCORD_PRESENCE) message(STATUS "Using static DiscordRPC from Externals") - add_subdirectory(Externals/discord-rpc EXCLUDE_FROM_ALL) - include_directories(Externals/discord-rpc/include) + add_subdirectory(Externals/discord-rpc EXCLUDE_FROM_ALL SYSTEM) + include_directories(SYSTEM Externals/discord-rpc/include) endif() if(NOT ENABLE_QT) @@ -955,7 +955,7 @@ if(USE_MGBA) find_package(LIBMGBA) if(NOT LIBMGBA_FOUND) message(STATUS "Using static libmgba from Externals") - add_subdirectory(Externals/mGBA) + add_subdirectory(Externals/mGBA SYSTEM) endif() endif() @@ -972,17 +972,17 @@ if(STEAM) endif() if (WIN32) - include_directories(Externals/WIL/include) - include_directories(Externals/OpenAL/include) + include_directories(SYSTEM Externals/WIL/include) + include_directories(SYSTEM Externals/OpenAL/include) endif() -include_directories(Externals/picojson) +include_directories(SYSTEM Externals/picojson) -add_subdirectory(Externals/expr) +add_subdirectory(Externals/expr SYSTEM) -add_subdirectory(Externals/rangeset) +add_subdirectory(Externals/rangeset SYSTEM) -add_subdirectory(Externals/FatFs) +add_subdirectory(Externals/FatFs SYSTEM) if (USE_RETRO_ACHIEVEMENTS) add_subdirectory(Externals/rcheevos) @@ -1014,7 +1014,7 @@ if(ENABLE_TESTS) message(STATUS "Using static gtest from Externals") # Force gtest to link the C runtime dynamically on Windows in order to avoid runtime mismatches. set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL) + add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL SYSTEM) else() message(STATUS "Unit tests are disabled") endif() From 1e3d09e67ff0ff09ef57f275a0d28ba5b6e38154 Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Sat, 15 Apr 2023 00:08:44 -0500 Subject: [PATCH 4/5] (Merge Later) Remove diagnostic ignores These should be removed after Externals become SYSTEM includes. --- Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 7 ------- Source/Core/Core/IOS/USB/Host.cpp | 7 ------- Source/Core/Core/IOS/USB/LibusbDevice.cpp | 7 ------- Source/Core/Core/LibusbUtils.cpp | 7 ------- Source/Core/Core/PowerPC/Expression.cpp | 7 ------- Source/Core/InputCommon/GCAdapter.cpp | 7 ------- Source/Core/UICommon/USBUtils.cpp | 7 ------- 7 files changed, 49 deletions(-) diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 2edb6bf0c41d..72f591c7f576 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -16,14 +16,7 @@ #include #include -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #include "Common/ChunkFile.h" #include "Common/Logging/Log.h" diff --git a/Source/Core/Core/IOS/USB/Host.cpp b/Source/Core/Core/IOS/USB/Host.cpp index 5f4d3208efc3..8870f730b058 100644 --- a/Source/Core/Core/IOS/USB/Host.cpp +++ b/Source/Core/Core/IOS/USB/Host.cpp @@ -11,14 +11,7 @@ #include #ifdef __LIBUSB__ -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #endif #include "Common/Assert.h" diff --git a/Source/Core/Core/IOS/USB/LibusbDevice.cpp b/Source/Core/Core/IOS/USB/LibusbDevice.cpp index 0b01c0ddd372..9e305b917981 100644 --- a/Source/Core/Core/IOS/USB/LibusbDevice.cpp +++ b/Source/Core/Core/IOS/USB/LibusbDevice.cpp @@ -13,14 +13,7 @@ #include #include -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #include "Common/Assert.h" #include "Common/Logging/Log.h" diff --git a/Source/Core/Core/LibusbUtils.cpp b/Source/Core/Core/LibusbUtils.cpp index 7eb628b09b88..1b1852dddd11 100644 --- a/Source/Core/Core/LibusbUtils.cpp +++ b/Source/Core/Core/LibusbUtils.cpp @@ -7,14 +7,7 @@ #include #if defined(__LIBUSB__) -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #endif #include "Common/Assert.h" diff --git a/Source/Core/Core/PowerPC/Expression.cpp b/Source/Core/Core/PowerPC/Expression.cpp index 06004a9029ea..2fe2d8c036ed 100644 --- a/Source/Core/Core/PowerPC/Expression.cpp +++ b/Source/Core/Core/PowerPC/Expression.cpp @@ -11,14 +11,7 @@ #include #include -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #include "Common/BitUtils.h" #include "Common/CommonTypes.h" diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index 7780d486dd3c..a3853e9e6cf3 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -17,14 +17,7 @@ #include #if GCADAPTER_USE_LIBUSB_IMPLEMENTATION -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #elif GCADAPTER_USE_ANDROID_IMPLEMENTATION #include #endif diff --git a/Source/Core/UICommon/USBUtils.cpp b/Source/Core/UICommon/USBUtils.cpp index f86dbb7169ba..2264afe82cca 100644 --- a/Source/Core/UICommon/USBUtils.cpp +++ b/Source/Core/UICommon/USBUtils.cpp @@ -7,14 +7,7 @@ #include #ifdef __LIBUSB__ -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif #include -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #endif #include "Common/CommonTypes.h" From 5829a4469ae1c582910e8696ff833f68b57a52b2 Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Sat, 15 Apr 2023 00:09:56 -0500 Subject: [PATCH 5/5] (Temporary) Resolve [-Wzero-as-null-pointer-constant] in Externals This shouldn't be necesssary after Externals become SYSTEM includes. --- Externals/cpp-optparse/OptionParser.h | 2 +- Externals/picojson/picojson.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals/cpp-optparse/OptionParser.h b/Externals/cpp-optparse/OptionParser.h index aab832c00c25..d9f9ff65ec24 100644 --- a/Externals/cpp-optparse/OptionParser.h +++ b/Externals/cpp-optparse/OptionParser.h @@ -77,7 +77,7 @@ class Values { class Option { public: Option(const OptionParser& p) : - _parser(p), _action("store"), _type("string"), _nargs(1), _callback(0) {} + _parser(p), _action("store"), _type("string"), _nargs(1), _callback(nullptr) {} virtual ~Option() {} Option& action(const std::string& a); diff --git a/Externals/picojson/picojson.h b/Externals/picojson/picojson.h index 8d09f05fe163..c136b11c2523 100644 --- a/Externals/picojson/picojson.h +++ b/Externals/picojson/picojson.h @@ -1063,7 +1063,7 @@ template inline std::string parse(value &out, Iter &pos, const I template inline Iter _parse(Context &ctx, const Iter &first, const Iter &last, std::string *err) { input in(first, last); - if (!_parse(ctx, in) && err != NULL) { + if (!_parse(ctx, in) && err != nullptr) { char buf[64]; SNPRINTF(buf, sizeof(buf), "syntax error at line %d near: ", in.line()); *err = buf;