This commit is contained in:
Craig 2026-03-20 23:40:55 -05:00 committed by GitHub
commit 9f72ed7599
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
56 changed files with 1504 additions and 66 deletions

View File

@ -207,6 +207,8 @@ Summary:
- The preferred form of the increment and decrement operator in for-loops is prefix-form (e.g. `++var`).
## <a name="cpp-code-headers"></a>Headers
- When including Windowsspecific headers (e.g., windows.h, winnt.h, shlwapi.h), the #include directive must be lower case as some cross-compilers (e.g. MingW) may be used on case-sensitive filesystems such as Linux, where the files are typically lower case.
- `#include <windows.h>`
- If a header is not necessary in a certain source file, remove them.
- If you find duplicate includes of a certain header, remove it.
- When declaring includes in a source file, make sure they follow the given pattern:

View File

@ -11,7 +11,7 @@
#include "Core/Config/MainSettings.h"
#ifdef _WIN32
#include <Objbase.h>
#include <objbase.h>
#endif
// ~10 ms - needs to be at least 240 for surround

View File

@ -14,7 +14,7 @@
#include <cubeb/cubeb.h>
#ifdef _WIN32
#include <Objbase.h>
#include <objbase.h>
#endif
static void LogCallback(const char* format, ...)

View File

@ -7,7 +7,7 @@
// clang-format off
#include <initguid.h>
#include <Audioclient.h>
#include <audioclient.h>
#include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h>
#include <wil/resource.h>

View File

@ -6,7 +6,7 @@
#ifdef _WIN32
// clang-format off
#include <Windows.h>
#include <windows.h>
#include <mmreg.h>
#include <objbase.h>
#include <wil/resource.h>

View File

@ -21,7 +21,7 @@
#include "Common/SmallVector.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#ifdef __APPLE__
#include <libkern/OSCacheControl.h>

View File

@ -12,7 +12,7 @@
#ifdef __APPLE__
#include <sys/sysctl.h>
#elif defined(_WIN32)
#include <Windows.h>
#include <windows.h>
#include <arm64intr.h>
#include "Common/WindowsRegistry.h"
#elif defined(__linux__)

View File

@ -9,7 +9,7 @@
#ifdef _WIN32
#include <windows.h>
#include <SetupAPI.h>
#include <setupapi.h>
#define strerror_r(err, buf, len) strerror_s(buf, len, err)

View File

@ -1,7 +1,7 @@
// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <Windows.h>
#include <windows.h>
#include <functional>
#include <optional>
#include <string>

View File

@ -8,7 +8,7 @@
#include <fmt/format.h>
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#else
#include <dlfcn.h>
#endif

View File

@ -11,8 +11,8 @@
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#ifdef _MSC_VER
#include <Windows.h>
#ifdef _WIN32
#include <windows.h>
#elifdef ANDROID
#include "jni/AndroidCommon/AndroidCommon.h"
#endif

View File

@ -29,13 +29,13 @@
#include "Common/StringUtil.h"
#ifdef _WIN32
#include <Windows.h>
#include <Shlwapi.h>
#include <windows.h>
#include <commdlg.h> // for GetSaveFileName
#include <direct.h> // getcwd
#include <io.h>
#include <objbase.h> // guid stuff
#include <shellapi.h>
#include <shlwapi.h>
#else
#include <libgen.h>
#include <stdlib.h>

View File

@ -3,9 +3,9 @@
#include "Common/LdrWatcher.h"
#include <Windows.h>
#include <TlHelp32.h>
#include <windows.h>
#include <string>
#include <tlhelp32.h>
#include <winternl.h>
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA

View File

@ -13,7 +13,7 @@
#include <netinet/in.h>
#include <sys/socket.h>
#else
#include <WinSock2.h>
#include <winsock2.h>
#endif
#include <fmt/format.h>

View File

@ -4,7 +4,7 @@
#include "Common/QoSSession.h"
#if defined(_WIN32)
#include <Qos2.h>
#include <qos2.h>
#pragma comment(lib, "qwave")
#endif

View File

@ -5,7 +5,7 @@
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
namespace Common
{

View File

@ -4,8 +4,8 @@
#pragma once
#ifdef _WIN32
#include <WinSock2.h>
#include <mutex>
#include <winsock2.h>
#endif
namespace Common

View File

@ -26,7 +26,7 @@
#include "Common/Logging/Log.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#include <shellapi.h>
constexpr u32 CODEPAGE_SHIFT_JIS = 932;
constexpr u32 CODEPAGE_WINDOWS_1252 = 1252;

View File

@ -4,7 +4,7 @@
#include "Common/Thread.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#include <processthreadsapi.h>
#else
#include <pthread.h>

View File

@ -8,7 +8,7 @@
#include "Common/CommonFuncs.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#include <timeapi.h>
#endif

View File

@ -7,7 +7,7 @@
#include <string>
#include "Hidclass.h"
#include "hidclass.h"
#include "Common/CommonFuncs.h"
#include "Common/Logging/Log.h"

View File

@ -16,11 +16,10 @@
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Windows.h>
#include <SetupAPI.h>
#include <windows.h>
#include <cfgmgr32.h>
#include <devpropdef.h>
#include <setupapi.h>
#include "Common/Functional.h"

View File

@ -1,6 +1,6 @@
#include "Common/WindowsRegistry.h"
#include <Windows.h>
#include <windows.h>
#include <string>
#include <type_traits>
#include "Common/StringUtil.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include <Windows.h>
#include <windows.h>
#include <string>
#include "Common/CommonTypes.h"

View File

@ -11,7 +11,7 @@
#include <vector>
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#include "Common/Assert.h"

View File

@ -13,7 +13,7 @@
#include <fmt/format.h>
#if defined(_WIN32)
#include <Windows.h>
#include <windows.h>
#include "Common/WindowsRegistry.h"
#elif defined(__APPLE__)
#include <objc/message.h>

View File

@ -4,7 +4,7 @@
#include "Core/HW/DSPHLE/UCodes/ROM.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#include "Common/ChunkFile.h"

View File

@ -7,7 +7,7 @@
#include <memory>
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#include "Common/ChunkFile.h"

View File

@ -4,7 +4,7 @@
#pragma once
#ifdef _WIN32
#include <WinSock2.h>
#include <winsock2.h>
using socklen_t = int;
#else
#include <netinet/in.h>

View File

@ -11,7 +11,7 @@
#include "SFML/Network/IpAddress.hpp"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#include <SFML/Network.hpp>

View File

@ -20,7 +20,7 @@
#include "Core/System.h"
#ifdef _WIN32
#include <Objbase.h>
#include <objbase.h>
#endif
namespace ExpansionInterface

View File

@ -9,11 +9,11 @@
#include <optional>
#include <vector>
#include <Windows.h>
#include <BluetoothAPIs.h>
#include <Cfgmgr32.h>
#include <Hidclass.h>
#include <Hidsdi.h>
#include <windows.h>
#include <bluetoothapis.h>
#include <cfgmgr32.h>
#include <hidclass.h>
#include <hidsdi.h>
#include <initguid.h>
#include <wtypes.h>
// initguid.h must be included before devpkey.h

View File

@ -12,7 +12,7 @@
#ifdef _WIN32
// TODO: Horrible hack, remove ASAP!
#include <Windows.h>
#include <windows.h>
#endif
#include "Common/CommonTypes.h"

View File

@ -4,7 +4,7 @@
#pragma once
#ifdef _WIN32
#include <WinSock2.h>
#include <winsock2.h>
#else
#include <netinet/in.h>
#endif

View File

@ -4,8 +4,8 @@
#pragma once
#ifdef _WIN32
#include <WinSock2.h>
#include <iphlpapi.h>
#include <winsock2.h>
#include <ws2tcpip.h>
typedef pollfd pollfd_t;

View File

@ -21,7 +21,7 @@
#include "Core/System.h"
#ifdef _WIN32
#include <Objbase.h>
#include <objbase.h>
#endif
#ifdef ANDROID

View File

@ -9,7 +9,7 @@
#include <mutex>
#ifdef _WIN32
#include <WinSock2.h>
#include <winsock2.h>
using socklen_t = int;
#else
#include <netinet/in.h>

View File

@ -9,8 +9,8 @@
#include <optional>
#include <string.h>
#ifdef _WIN32
#include <WinSock2.h>
#include <iphlpapi.h>
#include <winsock2.h>
#include <ws2tcpip.h>
typedef SSIZE_T ssize_t;
#define SHUT_RDWR SD_BOTH

View File

@ -12,7 +12,7 @@
#ifndef _WIN32
#include <unistd.h>
#else
#include <Windows.h>
#include <windows.h>
#endif
#include "Common/ScopeGuard.h"

View File

@ -8,7 +8,7 @@
#include "Core/Core.h"
#include "Core/System.h"
#include <Windows.h>
#include <windows.h>
#include <climits>
#include <dwmapi.h>

View File

@ -6,7 +6,7 @@
#include <string>
#include <vector>
#include <Windows.h>
#include <windows.h>
#endif
#ifdef __linux__

View File

@ -32,7 +32,7 @@
#include "VideoCommon/Present.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#include <dwmapi.h>
#endif

View File

@ -7,8 +7,8 @@
#include <unordered_set>
#include <vector>
#include <Windows.h>
#include <SetupAPI.h>
#include <windows.h>
#include <setupapi.h>
namespace ciface::DInput
{

View File

@ -3,7 +3,7 @@
#pragma once
#include <Windows.h>
#include <windows.h>
#include <unordered_set>
namespace ciface::DInput

View File

@ -7,7 +7,7 @@
#include <string>
#include <thread>
#include <Windows.h>
#include <windows.h>
#include "Common/Event.h"
#include "Common/Flag.h"

View File

@ -8,7 +8,7 @@
#include <vector>
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#include <SDL3/SDL.h>

View File

@ -3,7 +3,7 @@
#include "InputCommon/ControllerInterface/Win32/Win32.h"
#include <Windows.h>
#include <windows.h>
#include <cfgmgr32.h>
// must be before hidclass
#include <initguid.h>

View File

@ -9,7 +9,7 @@
#pragma once
#include <windows.h>
#include <XInput.h>
#include <xinput.h>
#include "InputCommon/ControllerInterface/ControllerInterface.h"

View File

@ -16,7 +16,7 @@
#include "Common/Version.h"
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#else
#include <unistd.h>
#endif

View File

@ -30,7 +30,7 @@
#endif
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#include <filesystem>
#endif

View File

@ -2,8 +2,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <windows.h>
#include <ShlObj.h>
#include <shellapi.h>
#include <shlobj.h>
#include <optional>
#include <string>

View File

@ -1,4 +1,4 @@
#include <Windows.h>
#include <windows.h>
#include <filesystem>
#include <map>

View File

@ -7,11 +7,11 @@
#include <string>
#include <thread>
#include <Windows.h>
#include <CommCtrl.h>
#include <ShObjIdl.h>
#include <ShlObj.h>
#include <windows.h>
#include <commctrl.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shobjidl.h>
#include <wrl/client.h>
#include "Common/Event.h"

View File

@ -94,7 +94,7 @@
#include <vector>
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#include "Common/Common.h"

View File

@ -63,6 +63,35 @@ if [ $FORCE -eq 0 ]; then
fi
fi
SCRIPT_DIR=$(dirname "$0")
# Generated from "ls *.h -1 > windows-headers.txt" inside mingw-w64/mingw-w64-headers/include.
# Get the source here: https://www.mingw-w64.org/source/
WINDOWS_HEADERS_FILE="${SCRIPT_DIR}/windows-headers.txt"
if [[ ! -f "$WINDOWS_HEADERS_FILE" ]]; then
echo >&2 "error: missing windows-headers.txt"
exit 1
fi
declare -A WINDOWS_HEADERS_MAP
mapfile -t headers < "$WINDOWS_HEADERS_FILE"
for header in "${headers[@]}"; do
[[ -z "$header" || "$header" =~ ^# ]] && continue
WINDOWS_HEADERS_MAP["${header,,}"]=1
done
function windows_include_check() {
local file="$1"
while read -r header; do
local lower="${header,,}"
if [[ -n "${WINDOWS_HEADERS_MAP[${lower}]:-}" ]] && [[ "$header" != "${lower}" ]]; then
echo "!!! ${file} not compliant to coding style:"
echo "Windows system includes must be lowercase: ${header}"
fail=1
fi
done < <(awk -F'[<>]' '/#include </ {print $2}' "$file")
}
did_java_setup=0
JAVA_CODESTYLE_FILE="./$($GIT rev-parse --show-cdup)/Source/Android/code-style-java.xml"
java_temp_dir=""
@ -125,6 +154,9 @@ for f in ${modified_files}; do
fail=1
fi
# Check windows includes are lowercase
windows_include_check "${f}"
# Check for newline at EOF.
last_line="$(tail -c 1 ${f})"
if [ -n "${last_line}" ]; then

1405
Tools/windows-headers.txt Normal file

File diff suppressed because it is too large Load Diff