Skip to content

Commit

Permalink
Resolve [-Wzero-as-null-pointer-constant] in Source
Browse files Browse the repository at this point in the history
  • Loading branch information
get committed Apr 15, 2023
1 parent 550f1bf commit f3dd4ba
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions Source/Core/Common/FatFsUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,15 @@ bool SyncSDFolderToSDImage(const std::function<bool()>& 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))
{
Expand Down Expand Up @@ -795,7 +803,15 @@ bool SyncSDImageToSDFolder(const std::function<bool()>& 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);
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
#include <vector>

#include <fmt/format.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <libusb.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include "Common/ChunkFile.h"
#include "Common/Logging/Log.h"
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/IOS/USB/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
#include <utility>

#ifdef __LIBUSB__
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <libusb.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif

#include "Common/Assert.h"
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/IOS/USB/LibusbDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
#include <utility>
#include <vector>

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <libusb.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include "Common/Assert.h"
#include "Common/Logging/Log.h"
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/LibusbUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#include <thread>

#if defined(__LIBUSB__)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <libusb.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif

#include "Common/Assert.h"
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/PowerPC/Expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
#include <string_view>
#include <utility>

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <expr.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/InputCommon/GCAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
#include <optional>

#if GCADAPTER_USE_LIBUSB_IMPLEMENTATION
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <libusb.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#elif GCADAPTER_USE_ANDROID_IMPLEMENTATION
#include <jni.h>
#endif
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/UICommon/USBUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@

#include <fmt/format.h>
#ifdef __LIBUSB__
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <libusb.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif

#include "Common/CommonTypes.h"
Expand Down

0 comments on commit f3dd4ba

Please sign in to comment.