Codefix: Make sure safeguards.h is the last included non-table header. (#14687)

This commit is contained in:
Peter Nelson
2025-10-11 10:22:50 +01:00
committed by dP
parent be3df87dd9
commit 1bae740aab
9 changed files with 42 additions and 28 deletions

View File

@@ -46,6 +46,10 @@
#include "company_cmd.h"
#include "misc_cmd.h"
#if defined(WITH_ZLIB)
#include "network/network_content.h"
#endif /* WITH_ZLIB */
#include "table/strings.h"
#include "citymania/cm_console_cmds.hpp"
@@ -2179,7 +2183,6 @@ static bool ConNetworkAuthorizedKey(std::span<std::string_view> argv)
/* Content downloading only is available with ZLIB */
#if defined(WITH_ZLIB)
#include "network/network_content.h"
/** Resolve a string to a content type. */
static ContentType StringToContentType(std::string_view str)

View File

@@ -7,6 +7,8 @@
/** @file freetypefontcache.cpp FreeType font cache implementation. */
#ifdef WITH_FREETYPE
#include "../stdafx.h"
#include "../debug.h"
@@ -20,14 +22,13 @@
#include "../table/control_codes.h"
#include "../safeguards.h"
#ifdef WITH_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_TRUETYPE_TABLES_H
#include "../safeguards.h"
/** Font cache for fonts that are based on a freetype font. */
class FreeTypeFontCache : public TrueTypeFontCache {
private:

View File

@@ -22,6 +22,10 @@
#include "table/strings.h"
#ifdef WITH_PNG
#include <png.h>
#endif /* WITH_PNG */
#include "safeguards.h"
/**
@@ -72,8 +76,6 @@ static inline uint8_t RGBToGreyscale(uint8_t red, uint8_t green, uint8_t blue)
#ifdef WITH_PNG
#include <png.h>
/**
* The PNG Heightmap loader.
*/

View File

@@ -96,13 +96,13 @@
#include "table/strings.h"
#include "safeguards.h"
#ifdef __EMSCRIPTEN__
# include <emscripten.h>
# include <emscripten/html5.h>
#endif
#include "safeguards.h"
void CallLandscapeTick();
void DoPaletteAnimations();
void MusicLoop();

View File

@@ -14,7 +14,6 @@
#include "../../fios.h"
#include "../../thread.h"
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -26,6 +25,10 @@
#include <SDL.h>
#endif
#ifdef WITH_ICONV
#include <iconv.h>
#endif /* WITH_ICONV */
#ifdef __EMSCRIPTEN__
# include <emscripten.h>
#endif
@@ -85,10 +88,6 @@ bool FiosIsHiddenFile(const std::filesystem::path &path)
#ifdef WITH_ICONV
#include <iconv.h>
#include "../../debug.h"
#include "../../string_func.h"
std::optional<std::string> GetCurrentLocale(const char *param);
#define INTERNALCODE "UTF-8"

View File

@@ -57,6 +57,18 @@
# include <emscripten.h>
#endif
#ifdef WITH_LZO
#include <lzo/lzo1x.h>
#endif
#if defined(WITH_ZLIB)
#include <zlib.h>
#endif /* WITH_ZLIB */
#if defined(WITH_LIBLZMA)
#include <lzma.h>
#endif /* WITH_LIBLZMA */
#include "table/strings.h"
#include "../safeguards.h"
@@ -2418,7 +2430,6 @@ struct FileWriter : SaveFilter {
*******************************************/
#ifdef WITH_LZO
#include <lzo/lzo1x.h>
/** Buffer size for the LZO compressor */
static const uint LZO_BUFFER_SIZE = 8192;
@@ -2547,7 +2558,6 @@ struct NoCompSaveFilter : SaveFilter {
********************************************/
#if defined(WITH_ZLIB)
#include <zlib.h>
/** Filter using Zlib compression. */
struct ZlibLoadFilter : LoadFilter {
@@ -2666,7 +2676,6 @@ struct ZlibSaveFilter : SaveFilter {
********************************************/
#if defined(WITH_LIBLZMA)
#include <lzma.h>
/**
* Have a copy of an initialised LZMA stream. We need this as it's

View File

@@ -28,7 +28,10 @@
#ifdef WITH_ICU_I18N
/* Required by StrNaturalCompare. */
# include <unicode/brkiter.h>
# include <unicode/stsearch.h>
# include <unicode/ustring.h>
# include <unicode/utext.h>
# include "language.h"
# include "gfx_func.h"
#endif /* WITH_ICU_I18N */
@@ -453,8 +456,6 @@ int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garb
#ifdef WITH_ICU_I18N
#include <unicode/stsearch.h>
/**
* Search if a string is contained in another string using the current locale.
*
@@ -601,9 +602,6 @@ bool ConvertHexToBytes(std::string_view hex, std::span<uint8_t> bytes)
#elif defined(WITH_ICU_I18N)
#include <unicode/utext.h>
#include <unicode/brkiter.h>
/** String iterator using ICU as a backend. */
class IcuStringIterator : public StringIterator
{

View File

@@ -30,14 +30,14 @@
#include "../../citymania/cm_hotkeys.hpp"
#include "../safeguards.h"
#ifdef _DEBUG
/* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
* be triggered, so rereplace the signals and make the debugger useful. */
#include <signal.h>
#endif
#include "../safeguards.h"
static FVideoDriver_Allegro iFVideoDriver_Allegro;
static BITMAP *_allegro_screen;

View File

@@ -32,6 +32,13 @@
#include <winrt/Windows.UI.ViewManagement.h>
#endif
#ifdef WITH_OPENGL
#include <GL/gl.h>
#include "../3rdparty/opengl/glext.h"
#include "../3rdparty/opengl/wglext.h"
#include "opengl.h"
#endif /* WITH_OPENGL */
#include "../citymania/cm_hotkeys.hpp"
#include "../safeguards.h"
@@ -1305,11 +1312,6 @@ void VideoDriver_Win32GDI::Paint()
#ifdef WITH_OPENGL
#include <GL/gl.h>
#include "../3rdparty/opengl/glext.h"
#include "../3rdparty/opengl/wglext.h"
#include "opengl.h"
#ifndef PFD_SUPPORT_COMPOSITION
# define PFD_SUPPORT_COMPOSITION 0x00008000
#endif