dolphin/Source/Core/Core
Dentomologist 58ab94c30c GCC: Suppress PPCSTATE_OFF invalid-offsetof warnings
Modify PPCSTATE_OFF and PPCSTATE_OFF_ARRAY macros when using GCC to
avoid useless log spam. Specifically, use a consteval lambda with gcc
_Pragma statements to disable the -Winvalid-offsetof warning inside the
macros.

Each successful build (and many failing ones) on the Android buildbot
generates almost 300 cases of -Winvalid-offsetof, resulting in thousands
of lines of log spam per build. In addition to bloating the log filesize
these spurious warnings make it harder to find actual warnings.

These warnings are generated by calls to the macros PPCSTATE_OFF and
PPCSTATE_OFF_ARRAY, which in turn are used by many other macros used by
the JIT. The ultimate cause is that offsetof is only conditionally
supported on non-standard-layout types, which includes the PowerPCState
struct.

To address potential questions of whether there's a better way to handle
this:

The obvious solution would be to modify PowerPCState so that it does
have a standard layout. This is unfortunately impractical.

To have a standard layout a type can only contain other types with
standard layouts. None of the stl containers are guaranteed to have
standard layouts, and PowerPCState contains a std::tuple and std::array.
PowerPCState also contains a PowerPC::Cache and InstructionCache which
themselves contain std:arrays and std::vectors.

Furthermore InstructionCache derives from Cache, and a derived class can
only have standard layout if at most one class in its hierarchy has a
non-static data member, but both classes have such members. Making
InstructionCache have a standard layout would require duplicating all
the functionality of Cache so it no longer derived from it, as well as
replacing the stl containers. This might require having a raw pointer to
said containers, with the manual memory management that implies.

All of that would be much more disruptive than would be justified to get
rid of some warnings (however annoying they might be). This is
compounded by the fact that PowerPCState hasn't had a standard layout
for a long time, if ever, and if the PPCSTATE_OFF macros weren't working
reliably it would have become obvious a long time ago.

As to why I picked the lambda solution over other potential changes:

- Keeping the define as-is and wrapping some gcc #pragmas around it
  doesn't work because the pragmas don't get included when the define is
  substituted to the call site.

- Keeping the define as a non-lambda expression and using inline
  _Pragma() statements would ideally be better and works fine for msvc,
  but fails for GCC with "'#pragma' is not allowed here".

- Turning off -Winvalid-offsetof globally for gcc would work, but there
  might be other contexts where offsetof is problematic and GCC seems to
  be the only compiler warning about it.
2023-08-21 14:01:11 -07:00
..
Boot IOS/ES: Split ESDevice into ESCore and ESDevice. 2023-05-15 20:41:05 +02:00
Config Video: implement output resampling (upscaling/downscaling) methods 2023-08-18 02:00:55 +03:00
ConfigLoaders Remove force disable WC24 Standby 2023-07-22 22:24:09 -04:00
Debugger Kill AsciiToHex 2023-06-22 00:06:50 -05:00
DSP EnumUtils: Add Common::ToUnderlying 2023-06-17 07:15:33 -05:00
FifoPlayer Resolve [-Wclass-memaccess] 2023-04-12 03:59:57 -05:00
HLE HLE_OS: Manually handle printfs from emulated software to prevent emulated software from crashing Dolphin with an invalid printf formatting string. 2023-07-29 20:06:09 +02:00
HW Merge pull request #11996 from Dentomologist/remove_pointless_pauseandlock_functions 2023-08-18 21:35:56 +02:00
IOS Skylanders: expand and improve character list 2023-08-13 19:55:10 +02:00
PowerPC GCC: Suppress PPCSTATE_OFF invalid-offsetof warnings 2023-08-21 14:01:11 -07:00
AchievementManager.cpp Synchronized Achievement Window 2023-07-01 22:26:30 -04:00
AchievementManager.h Synchronized Achievement Window 2023-07-01 22:26:30 -04:00
ActionReplay.cpp Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
ActionReplay.h Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
ARDecrypt.cpp Replace BitUtils with C++20: RotateLeft/RotateRight 2022-12-11 08:59:18 +01:00
ARDecrypt.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
BootManager.cpp Added LoadGameByFilenameAsync and CloseGame to AchievementManager 2023-04-12 03:08:47 -04:00
BootManager.h Config: Port emulation speed setting to new config system. 2022-01-06 16:13:54 +01:00
CheatCodes.h Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
CheatGeneration.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
CheatGeneration.h Core/CheatSearch: Implement cheat searching functionality. 2021-09-15 19:05:48 +02:00
CheatSearch.cpp PowerPC/MMU: Refactor to class, move to System. 2023-03-28 03:47:51 +02:00
CheatSearch.h DolphinQt: Properly lock CPU before accessing emulated memory 2023-02-12 11:27:50 +01:00
CMakeLists.txt Merge pull request #11955 from TellowKrinkle/CMakeDependencies 2023-06-30 19:06:04 +02:00
CommonTitles.h Add default support for WiiLink + configuration 2023-06-25 14:57:15 -04:00
ConfigManager.cpp Add default support for WiiLink + configuration 2023-06-25 14:57:15 -04:00
ConfigManager.h Merge pull request #11751 from noahpistilli/discord-rpc 2023-05-19 19:35:17 +02:00
Core.cpp Merge pull request #11996 from Dentomologist/remove_pointless_pauseandlock_functions 2023-08-18 21:35:56 +02:00
Core.h Core: Assert that only the Host thread may call PauseAndLock(). 2023-06-02 18:51:43 +02:00
CoreTiming.cpp Core: save core timing parameters into variables updated during refresh 2023-07-23 14:03:21 -05:00
CoreTiming.h Core: save core timing parameters into variables updated during refresh 2023-07-23 14:03:21 -05:00
DolphinAnalytics.cpp Video: implement color correction to match the NTSC and PAL color spaces (and gamma) that GC and Wii targeted. 2023-06-19 01:34:42 +03:00
DolphinAnalytics.h DolphinAnalytics: Add READS_BOUNDING_BOX game quirk 2023-05-06 17:18:17 -07:00
DSPEmulator.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
DSPEmulator.h DSPEmulator: Remove unused PauseAndLock parameter 2023-06-25 20:29:23 -07:00
FreeLookConfig.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FreeLookConfig.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FreeLookManager.cpp ControllerEmu: Convert Translatability to enum class 2023-06-12 18:11:04 -07:00
FreeLookManager.h Core / VideoCommon: refactor FreeLookCamera to have the underlying controller handle all the logic (field-of-view, movement, etc) 2021-10-08 18:16:32 -05:00
GeckoCode.cpp PowerPC/MMU: Refactor to class, move to System. 2023-03-28 03:47:51 +02:00
GeckoCode.h DolphinQt: Properly lock CPU before accessing emulated memory 2023-02-12 11:27:50 +01:00
GeckoCodeConfig.cpp Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
GeckoCodeConfig.h Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
Host.h Add Discord presence ioctlv to /dev/dolphin 2022-08-06 07:32:29 +01:00
HotkeyManager.cpp ControllerEmu: Convert Translatability to enum class 2023-06-12 18:11:04 -07:00
HotkeyManager.h Add Hotkeys for Skylanders Portal and Infinity Base Menus 2023-05-26 13:36:08 -07:00
LibusbUtils.cpp Log warnings when LibusbUtils::MakeConfigDescriptor fails 2022-06-08 15:29:11 -07:00
LibusbUtils.h Log warnings when LibusbUtils::MakeConfigDescriptor fails 2022-06-08 15:29:11 -07:00
MachineContext.h MachineContext: Fix USE_SIGACTION_ON_APPLE on arm64 2022-12-11 13:36:44 +00:00
MemoryWatcher.cpp PowerPC/MMU: Refactor to class, move to System. 2023-03-28 03:47:51 +02:00
MemoryWatcher.h DolphinQt: Properly lock CPU before accessing emulated memory 2023-02-12 11:27:50 +01:00
MemTools.cpp JitInterface: Refactor to class, move to System. 2023-03-26 14:38:07 +02:00
MemTools.h UnitTests: Skip PageFaultTest if exception handlers are not supported 2022-05-19 12:26:41 -07:00
Movie.cpp Common: Convert FromWhichRoot to enum class 2023-06-13 13:25:22 -07:00
Movie.h DolphinQt: Use input override system for TAS input windows 2022-10-03 22:04:09 +02:00
NetPlayClient.cpp Replace std::ostringstream usage with fmt::format 2023-06-18 18:37:32 -05:00
NetPlayClient.h Common/TraversalProto: Move interface into Common namespace 2023-04-24 08:53:14 -04:00
NetPlayCommon.cpp Core: Add missing header to NetPlayCommon.cpp 2021-12-15 18:57:10 +01:00
NetPlayCommon.h Updated PEER_TIMOUT in NetPlayCommon.h to use chrono literals; Updated NetPlayServer.cpp OnConnect() by putting commonly used code into named functions 2022-08-09 16:26:52 -06:00
NetPlayProto.h NetPlay: Limit ENet's MTU to 1392 as a workaround for dropped packets over VPN via WireGuard, see https://github.com/lsalzman/enet/issues/132 2023-04-02 17:23:10 +02:00
NetPlayServer.cpp Do not try portmapping when using traversal server 2023-07-13 01:15:12 -07:00
NetPlayServer.h Common/TraversalProto: Move interface into Common namespace 2023-04-24 08:53:14 -04:00
NetworkCaptureLogger.cpp NetworkCaptureLogger: Allow PCAP shared read access on Windows 2022-09-29 23:08:25 +04:00
NetworkCaptureLogger.h NetworkCaptureLogger: Add GameCube BBA support 2022-07-12 13:35:49 +04:00
PatchEngine.cpp Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
PatchEngine.h Common/IniFile: Move interface into Common namespace 2023-04-13 10:19:28 -04:00
State.cpp IOS/WiiSockMan: Move instance to IOS Kernel. 2023-04-18 01:24:10 +02:00
State.h Core/State: Rewrite threading behavior when multiple Save requests are happening. Should improve responsiveness when eg. mashing a save state button. 2022-10-02 00:00:29 +02:00
SyncIdentifier.h Added type to SyncIndentifierComparison enum in SyncIdentifier.h in an 2022-08-09 16:26:53 -06:00
SysConf.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SysConf.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
System.cpp Core: add CustomAssetLoader to System 2023-06-05 16:33:19 -05:00
System.h Core: add CustomAssetLoader to System 2023-06-05 16:33:19 -05:00
TitleDatabase.cpp StripSpaces: only strip spaces 2022-07-25 18:40:12 -07:00
TitleDatabase.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
WC24PatchEngine.cpp Add default support for WiiLink + configuration 2023-06-25 14:57:15 -04:00
WC24PatchEngine.h Add default support for WiiLink + configuration 2023-06-25 14:57:15 -04:00
WiiRoot.cpp Common: Convert FromWhichRoot to enum class 2023-06-13 13:25:22 -07:00
WiiRoot.h Core/Boot: Add Wii FS sync data (for temp NAND/netplay) to BootSessionData and handle it in the boot and shutdown logic. 2021-11-22 01:33:45 +01:00
WiiUtils.cpp Qt: Add file size stats to NAND Check. 2023-07-14 05:24:29 +02:00
WiiUtils.h Qt: Add file size stats to NAND Check. 2023-07-14 05:24:29 +02:00