1
0
Fork 0

Codefix: stdafx.h and safeguards.h should be the first and last include in every source file, and not appear in any header file.

pull/14052/head
frosch 2025-04-20 19:14:28 +02:00 committed by frosch
parent 54de376c55
commit 461b73e21b
29 changed files with 34 additions and 16 deletions

View File

@ -10,8 +10,6 @@
#ifndef KDTREE_HPP
#define KDTREE_HPP
#include "../stdafx.h"
/**
* K-dimensional tree, specialised for 2-dimensional space.
* This is not intended as a primary storage of data, but as an index into existing data.

View File

@ -9,6 +9,7 @@
#include "stdafx.h"
#include "error_func.h"
#include "safeguards.h"
[[noreturn]] void NOT_REACHED(const std::source_location location)
{

View File

@ -7,6 +7,8 @@
/** @file framerate_gui.cpp GUI for displaying framerate/game speed information. */
#include "stdafx.h"
#include "framerate_type.h"
#include <chrono>
#include "gfx_func.h"

View File

@ -35,7 +35,6 @@
#ifndef FRAMERATE_TYPE_H
#define FRAMERATE_TYPE_H
#include "stdafx.h"
#include "core/enum_type.hpp"
/**

View File

@ -16,6 +16,7 @@
#include <fluidsynth.h>
#include "../mixer.h"
#include <mutex>
#include "../safeguards.h"
static struct {
fluid_settings_t *settings; ///< FluidSynth settings handle

View File

@ -10,8 +10,6 @@
#ifndef MUSIC_MIDI_H
#define MUSIC_MIDI_H
#include "../stdafx.h"
/** Header of a Stanard MIDI File */
struct SMFHeader {
uint16_t format;

View File

@ -7,6 +7,8 @@
/* @file midifile.cpp Parser for standard MIDI files */
#include "../stdafx.h"
#include "midifile.hpp"
#include "../fileio_func.h"
#include "../fileio_type.h"
@ -21,6 +23,8 @@
#include "table/strings.h"
#include "../safeguards.h"
/* SMF reader based on description at: http://www.somascape.org/midi/tech/mfile.html */

View File

@ -10,7 +10,6 @@
#ifndef MUSIC_MIDIFILE_HPP
#define MUSIC_MIDIFILE_HPP
#include "../stdafx.h"
#include "../fileio_type.h"
#include "midi.h"

View File

@ -7,6 +7,8 @@
/** @file newgrf_profiling.cpp Profiling of NewGRF action 2 handling. */
#include "stdafx.h"
#include "newgrf_profiling.h"
#include "fileio_func.h"
#include "string_func.h"
@ -18,6 +20,7 @@
#include <chrono>
#include "safeguards.h"
std::vector<NewGRFProfiler> _newgrf_profilers;

View File

@ -10,7 +10,6 @@
#ifndef NEWGRF_PROFILING_H
#define NEWGRF_PROFILING_H
#include "stdafx.h"
#include "timer/timer_game_calendar.h"
#include "newgrf.h"
#include "newgrf_callbacks.h"

View File

@ -18,6 +18,7 @@
#include "macos.h"
#include <CoreFoundation/CoreFoundation.h>
#include "../../safeguards.h"
/* CTRunDelegateCreate is supported since MacOS X 10.5, but was only included in the SDKs starting with the 10.9 SDK. */

View File

@ -19,6 +19,7 @@
#include "../ship.h"
#include "../debug.h"
#include "../3rdparty/fmt/ranges.h"
#include "../safeguards.h"
using TWaterRegionTraversabilityBits = uint16_t;
constexpr TWaterRegionPatchLabel FIRST_REGION_LABEL = 1;

View File

@ -10,7 +10,6 @@
#ifndef YAPF_SHIP_REGIONS_H
#define YAPF_SHIP_REGIONS_H
#include "../../stdafx.h"
#include "../../tile_type.h"
#include "../water_regions.h"

View File

@ -10,8 +10,6 @@
#ifndef SPRITECACHE_INTERNAL_H
#define SPRITECACHE_INTERNAL_H
#include "stdafx.h"
#include "core/math_func.hpp"
#include "gfx_type.h"
#include "spriteloader/spriteloader.hpp"

View File

@ -9,6 +9,7 @@
#include "../stdafx.h"
#include "sprite_file_type.hpp"
#include "../safeguards.h"
/** Signature of a container version 2 GRF. */
extern const std::array<uint8_t, 8> _grf_cont_v2_sig = {'G', 'R', 'F', 0x82, 0x0D, 0x0A, 0x1A, 0x0A};

View File

@ -13,6 +13,8 @@
#include "../core/bitmath_func.hpp"
#include "../safeguards.h"
TEST_CASE("SetBitIterator tests")
{
auto test_case = [&](auto input, std::initializer_list<uint> expected) {

View File

@ -17,6 +17,8 @@
#include "../3rdparty/catch2/catch.hpp"
#include "../safeguards.h"
enum TestEnum : int8_t {
ZERO,
ONE,

View File

@ -14,6 +14,8 @@
#include "../landscape.h"
#include "../slope_func.h"
#include "../safeguards.h"
/**
* Check whether the addition of two slope's GetPartialPixelZ values results in
* the GetPartialPixelZ values of the expected slope.

View File

@ -13,6 +13,8 @@
#include "../core/math_func.hpp"
#include "../safeguards.h"
TEST_CASE("DivideApproxTest - Negative")
{
CHECK(-2 == DivideApprox(-5, 2));

View File

@ -10,8 +10,6 @@
#ifndef MOCK_FONTCACHE_H
#define MOCK_FONTCACHE_H
#include "../stdafx.h"
#include "../fontcache.h"
#include "../string_func.h"

View File

@ -15,6 +15,8 @@
#include "../spritecache_internal.h"
#include "../table/sprites.h"
#include "../safeguards.h"
static bool MockLoadNextSprite(SpriteID load_index)
{
static UniquePtrSpriteAllocator allocator;

View File

@ -18,6 +18,8 @@
#include "table/strings.h"
#include "../safeguards.h"
/**** String compare/equals *****/
TEST_CASE("StrCompareIgnoreCase - std::string")

View File

@ -16,6 +16,8 @@
#include "../network/core/packet.h"
#include "../string_func.h"
#include "../safeguards.h"
/* The length of the hexadecimal representation of a X25519 key must fit in the key length. */
static_assert(NETWORK_SECRET_KEY_LENGTH >= X25519_KEY_SIZE * 2 + 1);
static_assert(NETWORK_PUBLIC_KEY_LENGTH >= X25519_KEY_SIZE * 2 + 1);

View File

@ -22,6 +22,8 @@
#include <squirrel.h>
#include "../safeguards.h"
/**
* A controller to start enough so we can use Squirrel for testing.
*

View File

@ -15,6 +15,8 @@
#include "../window_gui.h"
#include "../safeguards.h"
/**
* List of WindowDescs. Defined in window.cpp but not exposed as this unit-test is the only other place that needs it.
* WindowDesc is a self-registering class so all WindowDescs will be included in the list.

View File

@ -10,7 +10,6 @@
#ifndef TIMER_GAME_CALENDAR_H
#define TIMER_GAME_CALENDAR_H
#include "../stdafx.h"
#include "../core/strong_typedef_type.hpp"
#include "timer_game_common.h"

View File

@ -11,8 +11,6 @@
#ifndef TIMER_MANAGER_H
#define TIMER_MANAGER_H
#include "../stdafx.h"
template <typename TTimerType>
class BaseTimer;

View File

@ -22,6 +22,8 @@
#include "../window_func.h"
#include "video_driver.hpp"
#include "../safeguards.h"
bool _video_hw_accel; ///< Whether to consider hardware accelerated video drivers on startup.
bool _video_vsync; ///< Whether we should use vsync (only if active video driver supports HW acceleration).

View File

@ -7,7 +7,6 @@
/** @file viewport_sprite_sorter.h Types related to sprite sorting. */
#include "stdafx.h"
#include "gfx_type.h"
#ifndef VIEWPORT_SPRITE_SORTER_H