Enable more compiler warnings and treat them as errors.
This commit is contained in:
@@ -69,7 +69,7 @@ static void GetExecutableName( char *buf, int bufsize )
|
||||
}
|
||||
#endif
|
||||
|
||||
static void NORETURN spawn_child_process( int from_parent )
|
||||
static void SM_NORETURN spawn_child_process( int from_parent )
|
||||
{
|
||||
/* We need to re-exec ourself, to get a clean process. Close all
|
||||
* FDs except for 0-2 and to_child, and then assign to_child to 3. */
|
||||
|
||||
@@ -230,6 +230,7 @@ static void child_process()
|
||||
}
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
}
|
||||
case CrashData::FORCE_CRASH:
|
||||
crash.reason[sizeof(crash.reason)-1] = 0;
|
||||
|
||||
@@ -204,7 +204,8 @@ bool X11Helper::SetWMFullscreenMonitors( const DisplaySpec &target )
|
||||
{
|
||||
auto mon = std::find_if( screens, end, [&]( XineramaScreenInfo &screen ) {
|
||||
return screen.x_org == target.currentBounds().left && screen.y_org == target.currentBounds().top
|
||||
&& screen.width == target.currentMode()->width && screen.height == target.currentMode()->height;
|
||||
&& screen.width >= 0 && static_cast<uint32_t>(screen.width) == target.currentMode()->width
|
||||
&& screen.height >= 0 && static_cast<uint32_t>(screen.height) == target.currentMode()->height;
|
||||
} );
|
||||
if (mon != end)
|
||||
{
|
||||
@@ -214,7 +215,7 @@ bool X11Helper::SetWMFullscreenMonitors( const DisplaySpec &target )
|
||||
}
|
||||
|
||||
XFree( screens );
|
||||
XWindowAttributes attr = {0};
|
||||
XWindowAttributes attr{};
|
||||
if (!found_bounds || !XGetWindowAttributes( Dpy, Win, &attr ))
|
||||
{
|
||||
return false;
|
||||
@@ -222,7 +223,7 @@ bool X11Helper::SetWMFullscreenMonitors( const DisplaySpec &target )
|
||||
|
||||
SetWMState( attr.root, Win, 1, XInternAtom( Dpy, "_NET_WM_STATE_FULLSCREEN", False ));
|
||||
|
||||
XClientMessageEvent xclient = {0};
|
||||
XClientMessageEvent xclient{};
|
||||
xclient.type = ClientMessage;
|
||||
xclient.window = Win;
|
||||
xclient.message_type = XInternAtom( Dpy, "_NET_WM_FULLSCREEN_MONITORS", False );
|
||||
|
||||
@@ -298,7 +298,7 @@ static DWORD WINAPI MainExceptionHandler( LPVOID lpParameter )
|
||||
#else
|
||||
pExc->ContextRecord->FloatSave.ControlWord |= 0x3F;
|
||||
#endif
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
return static_cast<DWORD>(EXCEPTION_CONTINUE_EXECUTION);
|
||||
}
|
||||
|
||||
static int InHere = 0;
|
||||
@@ -563,7 +563,7 @@ void CrashHandler::do_backtrace( const void **buf, size_t size,
|
||||
}
|
||||
|
||||
// Trigger the crash handler. This works even in the debugger.
|
||||
static void NORETURN debug_crash()
|
||||
static void SM_NORETURN debug_crash()
|
||||
{
|
||||
// __try {
|
||||
#if defined(__MSC_VER)
|
||||
|
||||
@@ -818,7 +818,6 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
XNode xml;
|
||||
if( sError.empty() )
|
||||
{
|
||||
RString sError;
|
||||
XmlFileUtil::Load( &xml, sResult, sError );
|
||||
if( !sError.empty() )
|
||||
{
|
||||
|
||||
@@ -79,43 +79,7 @@ static RString wo_ssprintf( MMRESULT err, const char *fmt, ...)
|
||||
return s += ssprintf( "(%s)", buf );
|
||||
}
|
||||
|
||||
static void GetDriveDebugInfo9x()
|
||||
{
|
||||
|
||||
/*
|
||||
* HKEY_LOCAL_MACHINE\Enum\ESDI
|
||||
* *\ (disk id)
|
||||
* *\ (eg. MF&CHILD0000&PCI&VEN_8086&DEV_7111&SUBSYS_197615AD&REV_01&BUS_00&DEV_07&FUNC_0100)
|
||||
* DMACurrentlyUsed 0 or 1
|
||||
* DeviceDesc "GENERIC IDE DISK TYPE01"
|
||||
*/
|
||||
std::vector<RString> Drives;
|
||||
if( !RegistryAccess::GetRegSubKeys( "HKEY_LOCAL_MACHINE\\Enum\\ESDI", Drives ) )
|
||||
return;
|
||||
|
||||
for( unsigned drive = 0; drive < Drives.size(); ++drive )
|
||||
{
|
||||
std::vector<RString> IDs;
|
||||
if( !RegistryAccess::GetRegSubKeys( Drives[drive], IDs ) )
|
||||
continue;
|
||||
|
||||
for( unsigned id = 0; id < IDs.size(); ++id )
|
||||
{
|
||||
RString DeviceDesc;
|
||||
|
||||
RegistryAccess::GetRegValue( IDs[id], "DeviceDesc", DeviceDesc );
|
||||
TrimRight( DeviceDesc );
|
||||
|
||||
int DMACurrentlyUsed = -1;
|
||||
RegistryAccess::GetRegValue( IDs[id], "DMACurrentlyUsed", DMACurrentlyUsed );
|
||||
|
||||
LOG->Info( "Drive: \"%s\" DMA: %s",
|
||||
DeviceDesc.c_str(), DMACurrentlyUsed? "yes":"NO" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void GetDriveDebugInfoNT()
|
||||
static void GetDriveDebugInfo()
|
||||
{
|
||||
/*
|
||||
* HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\Scsi\
|
||||
@@ -169,31 +133,15 @@ static void GetDriveDebugInfoNT()
|
||||
}
|
||||
}
|
||||
|
||||
static void GetDriveDebugInfo()
|
||||
{
|
||||
OSVERSIONINFO ovi;
|
||||
ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
if( !GetVersionEx(&ovi) )
|
||||
{
|
||||
LOG->Info("GetVersionEx failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
switch( ovi.dwPlatformId )
|
||||
{
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
GetDriveDebugInfo9x(); break;
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
GetDriveDebugInfoNT(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void GetWindowsVersionDebugInfo()
|
||||
{
|
||||
// Detect operating system.
|
||||
OSVERSIONINFO ovi;
|
||||
ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4996 )
|
||||
if (!GetVersionEx(&ovi))
|
||||
#pragma warning( pop )
|
||||
{
|
||||
LOG->Info("GetVersionEx failed!");
|
||||
return;
|
||||
|
||||
@@ -1,27 +1,10 @@
|
||||
#ifndef DIRECTX_HELPERS_H
|
||||
#define DIRECTX_HELPERS_H
|
||||
#include "windows.h"
|
||||
#include "VersionHelpers.h"
|
||||
|
||||
RString hr_ssprintf( int hr, const char *fmt, ... );
|
||||
|
||||
//Keep XP on life support
|
||||
static bool at_least_vista()
|
||||
{
|
||||
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, { 0 }, 0, 0 };
|
||||
DWORDLONG const dwlConditionMask = VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
|
||||
VER_MINORVERSION, VER_GREATER_EQUAL),
|
||||
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||
|
||||
osvi.dwMajorVersion = 0x0600;
|
||||
osvi.dwMinorVersion = 0x0;
|
||||
osvi.wServicePackMajor = 0;
|
||||
|
||||
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != false;
|
||||
}
|
||||
|
||||
RString GetErrorString(HRESULT hr);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -417,7 +417,7 @@ void GraphicsWindow::Initialize( bool bD3D )
|
||||
g_bD3D = bD3D;
|
||||
|
||||
//keeping xp on life support -- check for vista+ for dwm
|
||||
if (at_least_vista())
|
||||
if (IsWindowsVistaOrGreater())
|
||||
{
|
||||
hInstanceDwmapi = LoadLibraryA("dwmapi.dll");
|
||||
}
|
||||
|
||||
@@ -62,19 +62,13 @@ RString GetPrimaryVideoDriverName()
|
||||
/* Get info for the given card number. Return false if that card doesn't exist. */
|
||||
bool GetVideoDriverInfo( int iCardno, VideoDriverInfo &info )
|
||||
{
|
||||
OSVERSIONINFO version;
|
||||
version.dwOSVersionInfoSize = sizeof(version);
|
||||
GetVersionEx(&version);
|
||||
const bool bIsWin9x = version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;
|
||||
|
||||
static bool bInitialized=false;
|
||||
static std::vector<RString> lst;
|
||||
if( !bInitialized )
|
||||
{
|
||||
bInitialized = true;
|
||||
|
||||
const RString sTopKey = bIsWin9x?
|
||||
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Class\\Display":
|
||||
const RString sTopKey =
|
||||
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}";
|
||||
|
||||
RegistryAccess::GetRegSubKeys( sTopKey, lst, ".*", false );
|
||||
@@ -113,7 +107,7 @@ bool GetVideoDriverInfo( int iCardno, VideoDriverInfo &info )
|
||||
RegistryAccess::GetRegValue( sKey, "DriverDate", info.sDate );
|
||||
RegistryAccess::GetRegValue( sKey, "MatchingDeviceId", info.sDeviceID );
|
||||
RegistryAccess::GetRegValue( sKey, "ProviderName", info.sProvider );
|
||||
RegistryAccess::GetRegValue( sKey, bIsWin9x? "Ver":"DriverVersion", info.sVersion );
|
||||
RegistryAccess::GetRegValue( sKey, "DriverVersion", info.sVersion );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1699,7 +1699,7 @@ typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
|
||||
ULONG ScollLock: 1;
|
||||
ULONG NumLock: 1;
|
||||
ULONG Reserved: 21;
|
||||
};
|
||||
} s;
|
||||
ULONG ul;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user