From 0c23e595fae417fa4bc49207549d250541d78311 Mon Sep 17 00:00:00 2001 From: wraitii Date: Tue, 18 May 2021 11:09:54 +0000 Subject: [PATCH] Include CStrInternStatic where necessary only. This makes incremental recompilation faster when changing static interned strings. Differential Revision: https://code.wildfiregames.com/D3975 This was SVN commit r25457. --- source/graphics/Decal.cpp | 1 + source/graphics/FontManager.cpp | 3 ++- source/graphics/LOSTexture.cpp | 3 ++- source/graphics/Material.cpp | 3 ++- source/graphics/MaterialManager.cpp | 3 ++- source/graphics/Model.cpp | 3 ++- source/graphics/ParticleEmitter.cpp | 3 ++- source/graphics/TextRenderer.cpp | 1 + source/gui/CGUIText.cpp | 1 + source/gui/GUIRenderer.cpp | 1 + source/gui/ObjectTypes/CChart.cpp | 1 + source/gui/ObjectTypes/CInput.cpp | 1 + source/gui/ObjectTypes/CMiniMap.cpp | 1 + source/pch/graphics/precompiled.h | 3 +-- source/ps/CConsole.cpp | 1 + source/ps/CLogger.cpp | 1 + source/ps/CStrIntern.h | 8 +------- source/ps/CStrInternStatic.h | 10 ++++++++++ source/ps/ProfileViewer.cpp | 1 + source/renderer/DebugRenderer.cpp | 1 + source/renderer/DecalRData.cpp | 1 + source/renderer/InstancingModelRenderer.cpp | 3 ++- source/renderer/ModelRenderer.cpp | 1 + source/renderer/OverlayRenderer.cpp | 1 + source/renderer/ParticleRenderer.cpp | 1 + source/renderer/PatchRData.cpp | 1 + source/renderer/PostprocManager.cpp | 3 ++- source/renderer/RenderModifiers.cpp | 1 + source/renderer/Renderer.cpp | 1 + source/renderer/ShadowMap.cpp | 1 + source/renderer/SilhouetteRenderer.cpp | 1 + source/renderer/SkyManager.cpp | 1 + source/renderer/TerrainOverlay.cpp | 1 + source/renderer/TerrainRenderer.cpp | 1 + source/renderer/TexturedLineRData.cpp | 1 + source/renderer/WaterManager.cpp | 1 + source/simulation2/system/ParamNode.cpp | 1 + source/simulation2/system/ParamNode.h | 2 +- 38 files changed, 55 insertions(+), 18 deletions(-) diff --git a/source/graphics/Decal.cpp b/source/graphics/Decal.cpp index 63981fff7e..513c456610 100644 --- a/source/graphics/Decal.cpp +++ b/source/graphics/Decal.cpp @@ -21,6 +21,7 @@ #include "graphics/Terrain.h" #include "maths/MathUtil.h" +#include "ps/CStrInternStatic.h" CModelAbstract* CModelDecal::Clone() const { diff --git a/source/graphics/FontManager.cpp b/source/graphics/FontManager.cpp index 8476e80be0..8820b4f076 100644 --- a/source/graphics/FontManager.cpp +++ b/source/graphics/FontManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -23,6 +23,7 @@ #include "graphics/TextureManager.h" #include "ps/CLogger.h" #include "ps/CStr.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "renderer/Renderer.h" diff --git a/source/graphics/LOSTexture.cpp b/source/graphics/LOSTexture.cpp index f934093978..4bb3035fe5 100644 --- a/source/graphics/LOSTexture.cpp +++ b/source/graphics/LOSTexture.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -23,6 +23,7 @@ #include "lib/bits.h" #include "lib/config2.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/Profile.h" #include "renderer/Renderer.h" diff --git a/source/graphics/Material.cpp b/source/graphics/Material.cpp index 7fb0346d7a..1273fbdac3 100644 --- a/source/graphics/Material.cpp +++ b/source/graphics/Material.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -18,6 +18,7 @@ #include "precompiled.h" #include "Material.h" +#include "ps/CStrInternStatic.h" static CColor BrokenColor(0.3f, 0.3f, 0.3f, 1.0f); diff --git a/source/graphics/MaterialManager.cpp b/source/graphics/MaterialManager.cpp index 52b9103938..36e4cc5f76 100644 --- a/source/graphics/MaterialManager.cpp +++ b/source/graphics/MaterialManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,6 +25,7 @@ #include "maths/Vector4D.h" #include "ps/CLogger.h" #include "ps/ConfigDB.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/XML/Xeromyces.h" #include "renderer/RenderingOptions.h" diff --git a/source/graphics/Model.cpp b/source/graphics/Model.cpp index df26093a4e..90b0b55127 100644 --- a/source/graphics/Model.cpp +++ b/source/graphics/Model.cpp @@ -35,8 +35,9 @@ #include "lib/res/graphics/ogl_tex.h" #include "lib/res/h_mgr.h" #include "lib/sysdep/rtl.h" -#include "ps/Profile.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" +#include "ps/Profile.h" #include "renderer/RenderingOptions.h" #include "simulation2/Simulation2.h" #include "simulation2/components/ICmpTerrain.h" diff --git a/source/graphics/ParticleEmitter.cpp b/source/graphics/ParticleEmitter.cpp index 7b0f1548dd..a9c6327b68 100644 --- a/source/graphics/ParticleEmitter.cpp +++ b/source/graphics/ParticleEmitter.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,6 +25,7 @@ #include "graphics/ParticleManager.h" #include "graphics/ShaderProgram.h" #include "graphics/TextureManager.h" +#include "ps/CStrInternStatic.h" #include "renderer/Renderer.h" diff --git a/source/graphics/TextRenderer.cpp b/source/graphics/TextRenderer.cpp index 3e1fca0780..b2b74c30f5 100644 --- a/source/graphics/TextRenderer.cpp +++ b/source/graphics/TextRenderer.cpp @@ -24,6 +24,7 @@ #include "graphics/ShaderProgram.h" #include "lib/ogl.h" #include "ps/CStrIntern.h" +#include "ps/CStrInternStatic.h" #include "ps/GameSetup/Config.h" #include "renderer/Renderer.h" diff --git a/source/gui/CGUIText.cpp b/source/gui/CGUIText.cpp index 52617f01e1..6b892a7434 100644 --- a/source/gui/CGUIText.cpp +++ b/source/gui/CGUIText.cpp @@ -25,6 +25,7 @@ #include "gui/CGUI.h" #include "gui/ObjectBases/IGUIObject.h" #include "gui/SettingTypes/CGUIString.h" +#include "ps/CStrInternStatic.h" #include "renderer/Renderer.h" #include diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp index 9af3ff81f7..8340dbd9bc 100644 --- a/source/gui/GUIRenderer.cpp +++ b/source/gui/GUIRenderer.cpp @@ -31,6 +31,7 @@ #include "lib/tex/tex.h" #include "lib/utf8.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "renderer/Renderer.h" diff --git a/source/gui/ObjectTypes/CChart.cpp b/source/gui/ObjectTypes/CChart.cpp index 841508caa2..658f485cda 100644 --- a/source/gui/ObjectTypes/CChart.cpp +++ b/source/gui/ObjectTypes/CChart.cpp @@ -25,6 +25,7 @@ #include "gui/SettingTypes/CGUISeries.h" #include "gui/SettingTypes/CGUIString.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Profile.h" #include "renderer/Renderer.h" diff --git a/source/gui/ObjectTypes/CInput.cpp b/source/gui/ObjectTypes/CInput.cpp index 13ce92a51f..e3066d8244 100644 --- a/source/gui/ObjectTypes/CInput.cpp +++ b/source/gui/ObjectTypes/CInput.cpp @@ -27,6 +27,7 @@ #include "lib/timer.h" #include "lib/utf8.h" #include "ps/ConfigDB.h" +#include "ps/CStrInternStatic.h" #include "ps/GameSetup/Config.h" #include "ps/Globals.h" #include "ps/Hotkey.h" diff --git a/source/gui/ObjectTypes/CMiniMap.cpp b/source/gui/ObjectTypes/CMiniMap.cpp index 3191d42943..5185e7bc50 100644 --- a/source/gui/ObjectTypes/CMiniMap.cpp +++ b/source/gui/ObjectTypes/CMiniMap.cpp @@ -35,6 +35,7 @@ #include "lib/ogl.h" #include "lib/timer.h" #include "ps/ConfigDB.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/Game.h" #include "ps/GameSetup/Config.h" diff --git a/source/pch/graphics/precompiled.h b/source/pch/graphics/precompiled.h index 82ebae81ed..85a1a48953 100644 --- a/source/pch/graphics/precompiled.h +++ b/source/pch/graphics/precompiled.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -21,5 +21,4 @@ #include "scriptinterface/ScriptTypes.h" #include "lib/ogl.h" #include "ps/CStr.h" -#include "ps/CStrIntern.h" #include "maths/Matrix3D.h" diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index aaec81a0da..94a73c830e 100644 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -37,6 +37,7 @@ #include "network/NetClient.h" #include "network/NetServer.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/GameSetup/Config.h" #include "ps/Globals.h" diff --git a/source/ps/CLogger.cpp b/source/ps/CLogger.cpp index 31bc8be5c1..e88dea5926 100644 --- a/source/ps/CLogger.cpp +++ b/source/ps/CLogger.cpp @@ -26,6 +26,7 @@ #include "lib/timer.h" #include "lib/utf8.h" #include "ps/CConsole.h" +#include "ps/CStrInternStatic.h" #include "ps/Profile.h" #include "ps/Pyrogenesis.h" #include "renderer/Renderer.h" diff --git a/source/ps/CStrIntern.h b/source/ps/CStrIntern.h index 34222e04c6..05104a43bf 100644 --- a/source/ps/CStrIntern.h +++ b/source/ps/CStrIntern.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -102,10 +102,4 @@ struct hash }; } -#define X(id) extern CStrIntern str_##id; -#define X2(id, str) extern CStrIntern str_##id; -#include "CStrInternStatic.h" -#undef X -#undef X2 - #endif // INCLUDED_CSTRINTERN diff --git a/source/ps/CStrInternStatic.h b/source/ps/CStrInternStatic.h index 8569765609..368c8a7122 100644 --- a/source/ps/CStrInternStatic.h +++ b/source/ps/CStrInternStatic.h @@ -26,6 +26,13 @@ // X2(foo_0, "foo[0]") // defines a variable str_foo_0 with value "foo[0]". +// For direct inclusion, we presumably just want the extern definitions. +#ifndef X +#include "CStrIntern.h" +#define X(id) extern CStrIntern str_##id; +#define X2(id, str) extern CStrIntern str_##id; +#endif + X(0) X(1) X(2) @@ -164,3 +171,6 @@ X(width) X(windAngle) X(zFar) X(zNear) + +#undef X +#undef X2 diff --git a/source/ps/ProfileViewer.cpp b/source/ps/ProfileViewer.cpp index 47d3057efa..2b3c43ae02 100644 --- a/source/ps/ProfileViewer.cpp +++ b/source/ps/ProfileViewer.cpp @@ -30,6 +30,7 @@ #include "gui/GUIMatrix.h" #include "lib/external_libraries/libsdl.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/Hotkey.h" #include "ps/Profile.h" diff --git a/source/renderer/DebugRenderer.cpp b/source/renderer/DebugRenderer.cpp index 720bb2edd5..d4327dbf66 100644 --- a/source/renderer/DebugRenderer.cpp +++ b/source/renderer/DebugRenderer.cpp @@ -28,6 +28,7 @@ #include "maths/Brush.h" #include "maths/Matrix3D.h" #include "maths/Vector3D.h" +#include "ps/CStrInternStatic.h" #include "renderer/Renderer.h" #include diff --git a/source/renderer/DecalRData.cpp b/source/renderer/DecalRData.cpp index cf03687d3e..48876385f6 100644 --- a/source/renderer/DecalRData.cpp +++ b/source/renderer/DecalRData.cpp @@ -27,6 +27,7 @@ #include "lib/allocators/DynamicArena.h" #include "lib/allocators/STLAllocators.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/Profile.h" #include "renderer/Renderer.h" diff --git a/source/renderer/InstancingModelRenderer.cpp b/source/renderer/InstancingModelRenderer.cpp index 1e96104618..21ab8fc2d2 100644 --- a/source/renderer/InstancingModelRenderer.cpp +++ b/source/renderer/InstancingModelRenderer.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -26,6 +26,7 @@ #include "maths/Vector3D.h" #include "maths/Vector4D.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "renderer/Renderer.h" #include "renderer/RenderModifiers.h" #include "renderer/VertexArray.h" diff --git a/source/renderer/ModelRenderer.cpp b/source/renderer/ModelRenderer.cpp index 036981a66e..7365f178d7 100644 --- a/source/renderer/ModelRenderer.cpp +++ b/source/renderer/ModelRenderer.cpp @@ -31,6 +31,7 @@ #include "maths/Vector3D.h" #include "maths/Vector4D.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Profile.h" #include "renderer/MikktspaceWrap.h" #include "renderer/ModelRenderer.h" diff --git a/source/renderer/OverlayRenderer.cpp b/source/renderer/OverlayRenderer.cpp index cee047a9ba..80d42412d7 100644 --- a/source/renderer/OverlayRenderer.cpp +++ b/source/renderer/OverlayRenderer.cpp @@ -29,6 +29,7 @@ #include "lib/ogl.h" #include "maths/MathUtil.h" #include "maths/Quaternion.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/Profile.h" #include "renderer/DebugRenderer.h" diff --git a/source/renderer/ParticleRenderer.cpp b/source/renderer/ParticleRenderer.cpp index fcbfbb9e68..2ca9b7739f 100644 --- a/source/renderer/ParticleRenderer.cpp +++ b/source/renderer/ParticleRenderer.cpp @@ -23,6 +23,7 @@ #include "graphics/ShaderDefines.h" #include "graphics/ShaderManager.h" #include "graphics/TextureManager.h" +#include "ps/CStrInternStatic.h" #include "ps/Profile.h" #include "renderer/DebugRenderer.h" #include "renderer/Renderer.h" diff --git a/source/renderer/PatchRData.cpp b/source/renderer/PatchRData.cpp index 44b65bec4a..94d9d86e63 100644 --- a/source/renderer/PatchRData.cpp +++ b/source/renderer/PatchRData.cpp @@ -31,6 +31,7 @@ #include "lib/allocators/STLAllocators.h" #include "maths/MathUtil.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/GameSetup/Config.h" #include "ps/Profile.h" diff --git a/source/renderer/PostprocManager.cpp b/source/renderer/PostprocManager.cpp index 52e9e311cb..0542f8728b 100644 --- a/source/renderer/PostprocManager.cpp +++ b/source/renderer/PostprocManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -27,6 +27,7 @@ #include "maths/MathUtil.h" #include "ps/ConfigDB.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/Game.h" #include "ps/World.h" diff --git a/source/renderer/RenderModifiers.cpp b/source/renderer/RenderModifiers.cpp index 955a2668d8..2f115d96f3 100644 --- a/source/renderer/RenderModifiers.cpp +++ b/source/renderer/RenderModifiers.cpp @@ -26,6 +26,7 @@ #include "maths/Vector4D.h" #include "maths/Matrix3D.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "graphics/GameView.h" diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index 081c4a7eaf..a687ee050e 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -31,6 +31,7 @@ #include "maths/MathUtil.h" #include "ps/CLogger.h" #include "ps/ConfigDB.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/Profile.h" #include "ps/Filesystem.h" diff --git a/source/renderer/ShadowMap.cpp b/source/renderer/ShadowMap.cpp index dad62f96b7..56d59d9992 100644 --- a/source/renderer/ShadowMap.cpp +++ b/source/renderer/ShadowMap.cpp @@ -32,6 +32,7 @@ #include "maths/Matrix3D.h" #include "ps/CLogger.h" #include "ps/ConfigDB.h" +#include "ps/CStrInternStatic.h" #include "ps/Profile.h" #include "renderer/DebugRenderer.h" #include "renderer/Renderer.h" diff --git a/source/renderer/SilhouetteRenderer.cpp b/source/renderer/SilhouetteRenderer.cpp index e43a4d2835..bc11153ef5 100644 --- a/source/renderer/SilhouetteRenderer.cpp +++ b/source/renderer/SilhouetteRenderer.cpp @@ -25,6 +25,7 @@ #include "graphics/Patch.h" #include "graphics/ShaderManager.h" #include "maths/MathUtil.h" +#include "ps/CStrInternStatic.h" #include "ps/Profile.h" #include "renderer/DebugRenderer.h" #include "renderer/Renderer.h" diff --git a/source/renderer/SkyManager.cpp b/source/renderer/SkyManager.cpp index a315c813ce..c5fd3ef408 100644 --- a/source/renderer/SkyManager.cpp +++ b/source/renderer/SkyManager.cpp @@ -34,6 +34,7 @@ #include "ps/CLogger.h" #include "ps/ConfigDB.h" #include "ps/CStr.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/Game.h" #include "ps/Loader.h" diff --git a/source/renderer/TerrainOverlay.cpp b/source/renderer/TerrainOverlay.cpp index 3434bc00ee..7fd2196c72 100644 --- a/source/renderer/TerrainOverlay.cpp +++ b/source/renderer/TerrainOverlay.cpp @@ -26,6 +26,7 @@ #include "lib/bits.h" #include "lib/ogl.h" #include "maths/MathUtil.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/Profile.h" #include "ps/World.h" diff --git a/source/renderer/TerrainRenderer.cpp b/source/renderer/TerrainRenderer.cpp index 3ff455dc68..21457a2858 100644 --- a/source/renderer/TerrainRenderer.cpp +++ b/source/renderer/TerrainRenderer.cpp @@ -36,6 +36,7 @@ #include "graphics/TextRenderer.h" #include "maths/MathUtil.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Filesystem.h" #include "ps/Game.h" #include "ps/Profile.h" diff --git a/source/renderer/TexturedLineRData.cpp b/source/renderer/TexturedLineRData.cpp index c64cb57088..49ee26c54a 100644 --- a/source/renderer/TexturedLineRData.cpp +++ b/source/renderer/TexturedLineRData.cpp @@ -24,6 +24,7 @@ #include "maths/Frustum.h" #include "maths/MathUtil.h" #include "maths/Quaternion.h" +#include "ps/CStrInternStatic.h" #include "renderer/OverlayRenderer.h" #include "renderer/Renderer.h" #include "simulation2/Simulation2.h" diff --git a/source/renderer/WaterManager.cpp b/source/renderer/WaterManager.cpp index dba0d75d77..647d9dc5ae 100644 --- a/source/renderer/WaterManager.cpp +++ b/source/renderer/WaterManager.cpp @@ -32,6 +32,7 @@ #include "maths/MathUtil.h" #include "maths/Vector2D.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/World.h" #include "renderer/WaterManager.h" diff --git a/source/simulation2/system/ParamNode.cpp b/source/simulation2/system/ParamNode.cpp index d3f857a916..5d87939153 100644 --- a/source/simulation2/system/ParamNode.cpp +++ b/source/simulation2/system/ParamNode.cpp @@ -22,6 +22,7 @@ #include "lib/utf8.h" #include "ps/CLogger.h" #include "ps/CStr.h" +#include "ps/CStrIntern.h" #include "ps/Filesystem.h" #include "ps/XML/Xeromyces.h" #include "scriptinterface/ScriptRequest.h" diff --git a/source/simulation2/system/ParamNode.h b/source/simulation2/system/ParamNode.h index 0bac6f07a1..06be0d783b 100644 --- a/source/simulation2/system/ParamNode.h +++ b/source/simulation2/system/ParamNode.h @@ -20,7 +20,6 @@ #include "lib/file/vfs/vfs_path.h" #include "maths/Fixed.h" -#include "ps/CStrIntern.h" #include "ps/Errors.h" #include "scriptinterface/ScriptTypes.h" @@ -30,6 +29,7 @@ class XMBData; class XMBElement; +class CStrIntern; class ScriptRequest; /**