From 16df0e4734e51a4caa9b2042f9e48988b70dd805 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 22 Aug 2026 09:38:25 +0200 Subject: [PATCH] Make public headers self-contained and stop relying on PCH Every public header now compiles on its own, and every source states its own dependencies rather than inheriting them (implicit) from StdAfx.h. Additionally, extend the CI to check if compiling without PCH still works. Co-Authored-By: Claude Opus 5 --- .teamcity/MacOS/Project.kt | 66 +++++++------ .teamcity/Windows/Project.kt | 183 ++++++++++++++++++----------------- CMakeLists.txt | 41 +++++++- CcpAssert.cpp | 1 + CcpCallstack.cpp | 4 + CcpDefines.cpp | 2 + CcpFileUtils.cpp | 3 + CcpHash.cpp | 2 + CcpLog.cpp | 1 + CcpMemory.cpp | 3 + CcpMemoryTracker.cpp | 2 + CcpStatistics.cpp | 3 + CcpTelemetry.cpp | 2 + CcpTime.cpp | 2 + include/CachedAllocator.h | 2 + include/CcpCallstack.h | 3 + include/CcpHash.h | 2 + include/CcpLog.h | 1 + include/CcpMemoryTracker.h | 2 + include/CcpPairingHeap.h | 2 + include/CcpSecureCrt.h | 9 +- include/CcpThread.h | 1 + include/ICcpStream.h | 1 + include/TrackableContainer.h | 5 +- 24 files changed, 222 insertions(+), 121 deletions(-) diff --git a/.teamcity/MacOS/Project.kt b/.teamcity/MacOS/Project.kt index e2a7768..7320c94 100644 --- a/.teamcity/MacOS/Project.kt +++ b/.teamcity/MacOS/Project.kt @@ -30,6 +30,8 @@ val x64_Internal = CarbonBuildMacOS("Internal MacOS x64", "Internal", "x64-osx-i val x64_TrinityDev = CarbonBuildMacOS("TrinityDev MacOS x64", "TrinityDev", "x64-osx-trinitydev", "x86_64") val x64_Release = CarbonBuildMacOS("Release MacOS x64", "Release", "x64-osx-release", "x86_64") +val arm64_NoPch = CarbonBuildMacOS("No PCH MacOS arm64", "Debug", "arm64-osx-debug", "aarch64", enablePch = false) + object Project : Project({ id("MacOS") name = "macOS" @@ -45,13 +47,17 @@ object Project : Project({ buildType(x64_Internal) buildType(x64_TrinityDev) buildType(x64_Release) + + buildType(arm64_NoPch) }) -class CarbonBuildMacOS(buildName: String, configType: String, preset: String, agentArchitecture: String) : BuildType({ +class CarbonBuildMacOS(buildName: String, configType: String, preset: String, agentArchitecture: String, enablePch: Boolean = true) : BuildType({ id(buildName.toId()) name = buildName - artifactRules = "%env.CMAKE_INSTALL_PREFIX%" + if (enablePch) { + artifactRules = "%env.CMAKE_INSTALL_PREFIX%" + } params { param("env.SENTRY_CLI_DEBUG_SYMBOL_TYPE", "dsym") @@ -104,34 +110,36 @@ class CarbonBuildMacOS(buildName: String, configType: String, preset: String, ag exec { name = "Configure" path = "cmake" - arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees" + arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DCCP_ENABLE_PCH=${if (enablePch) "ON" else "OFF"} -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees" } exec { name = "Build" path = "cmake" arguments = "--build %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE% --target %env.CMAKE_BUILD_TARGETS%" } - exec { - name = "Run Tests" - workingDir = "%env.CMAKE_BUILD_FOLDER%" - path = "ctest" - arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%" - } - exec { - name = "Package artifact" - path = "cmake" - arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%" - } - exec { - name = "Upload symbols to sentry" - path = "sentry-cli" - arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%" - param("script.content", """ - #!/usr/bin/env bash -eu - filesWithSymbols = ( - # insert your binary files with symbols here! - ) - """.trimIndent()) + if (enablePch) { + exec { + name = "Run Tests" + workingDir = "%env.CMAKE_BUILD_FOLDER%" + path = "ctest" + arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%" + } + exec { + name = "Package artifact" + path = "cmake" + arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%" + } + exec { + name = "Upload symbols to sentry" + path = "sentry-cli" + arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%" + param("script.content", """ + #!/usr/bin/env bash -eu + filesWithSymbols = ( + # insert your binary files with symbols here! + ) + """.trimIndent()) + } } } @@ -163,10 +171,12 @@ class CarbonBuildMacOS(buildName: String, configType: String, preset: String, ag } } } - xmlReport { - reportType = XmlReport.XmlReportType.JUNIT - rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%" - verbose = true + if (enablePch) { + xmlReport { + reportType = XmlReport.XmlReportType.JUNIT + rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%" + verbose = true + } } perfmon { } diff --git a/.teamcity/Windows/Project.kt b/.teamcity/Windows/Project.kt index 3f373ed..8d439b4 100644 --- a/.teamcity/Windows/Project.kt +++ b/.teamcity/Windows/Project.kt @@ -30,6 +30,8 @@ val Internal_v145 = CarbonBuildWindows("Internal Windows v145", "Internal", "x64 val TrinityDev_v145 = CarbonBuildWindows("TrinityDev Windows v145", "TrinityDev", "x64-windows-v145-trinitydev", "-arch=x64 -vcvars_ver=14.51") val Release_v145 = CarbonBuildWindows("Release Windows v145", "Release", "x64-windows-v145-release", "-arch=x64 -vcvars_ver=14.51") +val NoPch = CarbonBuildWindows("No PCH Windows", "Debug", "x64-windows-debug", enablePch = false) + object Project : Project({ id("Windows") name = "Windows" @@ -43,14 +45,17 @@ object Project : Project({ buildType(Internal_v145) buildType(TrinityDev_v145) buildType(Release_v145) -}) + buildType(NoPch) +}) -class CarbonBuildWindows(buildName: String, configType: String, preset: String, vsDevBatSwitches: String = "-arch=x64 -vcvars_ver=14.1") : BuildType({ +class CarbonBuildWindows(buildName: String, configType: String, preset: String, vsDevBatSwitches: String = "-arch=x64 -vcvars_ver=14.1", enablePch: Boolean = true) : BuildType({ id(buildName.toId()) this.name = buildName - artifactRules = "%env.CMAKE_INSTALL_PREFIX%" + if (enablePch) { + artifactRules = "%env.CMAKE_INSTALL_PREFIX%" + } params { param("env.GIT_TAG_HASH_OVERRIDE", "") @@ -108,95 +113,97 @@ class CarbonBuildWindows(buildName: String, configType: String, preset: String, exec { name = "Configure" path = "cmake" - arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees" + arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DCCP_ENABLE_PCH=${if (enablePch) "ON" else "OFF"} -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees" } exec { name = "Build" path = "cmake" arguments = "--build %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE% --target %env.CMAKE_BUILD_TARGETS%" } - exec { - name = "Run Tests" - workingDir = "%env.CMAKE_BUILD_FOLDER%" - path = "ctest" - arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%" - } - exec { - name = "Package artifact" - path = "cmake" - arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%" - } - exec { - name = "Upload symbols to sentry" - path = "sentry-cli" - arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%" - param("script.content", """ - #!/usr/bin/env bash -eu - filesWithSymbols = ( - # insert your binary files with symbols here! - ) - """.trimIndent()) - } - script { - name = "(Windows) CMD Upload debug symbols to internal symbol server" - scriptContent = """ - @echo off - ( - echo ${'$'}User = "%DOMAIN_USER%" - echo ${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force - echo ${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password - echo New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential - echo Write-Host "##teamcity[progressMessage 'Storing symbols']" - echo ${'$'}symstoreFlags = ^@^("add","/compress","/t", "CCP Games", "/c", "TeamCity %build.number%", "/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", "/o", "/r", "/f", "%env.CMAKE_BUILD_FOLDER%"^) - echo ^& ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags ^| Tee-Object -file symstore.txt - echo ${'$'}stored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}" - echo ${'$'}stored = ${'$'}stored.Matches.Groups[1].Value - echo ${'$'}errors = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of errors = (.*)${'$'}" - echo ${'$'}errors = ${'$'}errors.Matches.Groups[1].Value - echo ${'$'}ignored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}" - echo ${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value - echo Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']" - ) > file.ps1 - powershell -File file.ps1 - """.trimIndent() - } - powerShell { - name = "(Windows) Upload debug symbols to internal symbol server" - enabled = false - - conditions { - startsWith("teamcity.agent.jvm.os.name", "Windows") + if (enablePch) { + exec { + name = "Run Tests" + workingDir = "%env.CMAKE_BUILD_FOLDER%" + path = "ctest" + arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%" + } + exec { + name = "Package artifact" + path = "cmake" + arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%" + } + exec { + name = "Upload symbols to sentry" + path = "sentry-cli" + arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%" + param("script.content", """ + #!/usr/bin/env bash -eu + filesWithSymbols = ( + # insert your binary files with symbols here! + ) + """.trimIndent()) } - scriptMode = script { - content = """ - ${'$'}User = "%DOMAIN_USER%" - ${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force - ${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password - New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential - - Write-Host "##teamcity[progressMessage 'Storing symbols']" - ${'$'}symstoreFlags = @("add", - "/compress", - "/t", "CCP Games", # Product Name - "/c", "TeamCity %build.number%", #Comment - "/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", # Store destination - "/o", # Verbose - "/r", # Recursive - "/f", "%env.CMAKE_BUILD_FOLDER%") # source folder - & ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags | Tee-Object -file symstore.txt - - ${'$'}stored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}" - ${'$'}stored = ${'$'}stored.Matches.Groups[1].Value - - ${'$'}errors = get-content symstore.txt | Select-String "^SYMSTORE: Number of errors = (.*)${'$'}" - ${'$'}errors = ${'$'}errors.Matches.Groups[1].Value - - ${'$'}ignored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}" - ${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value - - Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']" + script { + name = "(Windows) CMD Upload debug symbols to internal symbol server" + scriptContent = """ + @echo off + ( + echo ${'$'}User = "%DOMAIN_USER%" + echo ${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force + echo ${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password + echo New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential + echo Write-Host "##teamcity[progressMessage 'Storing symbols']" + echo ${'$'}symstoreFlags = ^@^("add","/compress","/t", "CCP Games", "/c", "TeamCity %build.number%", "/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", "/o", "/r", "/f", "%env.CMAKE_BUILD_FOLDER%"^) + echo ^& ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags ^| Tee-Object -file symstore.txt + echo ${'$'}stored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}" + echo ${'$'}stored = ${'$'}stored.Matches.Groups[1].Value + echo ${'$'}errors = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of errors = (.*)${'$'}" + echo ${'$'}errors = ${'$'}errors.Matches.Groups[1].Value + echo ${'$'}ignored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}" + echo ${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value + echo Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']" + ) > file.ps1 + powershell -File file.ps1 """.trimIndent() } + powerShell { + name = "(Windows) Upload debug symbols to internal symbol server" + enabled = false + + conditions { + startsWith("teamcity.agent.jvm.os.name", "Windows") + } + scriptMode = script { + content = """ + ${'$'}User = "%DOMAIN_USER%" + ${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force + ${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password + New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential + + Write-Host "##teamcity[progressMessage 'Storing symbols']" + ${'$'}symstoreFlags = @("add", + "/compress", + "/t", "CCP Games", # Product Name + "/c", "TeamCity %build.number%", #Comment + "/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", # Store destination + "/o", # Verbose + "/r", # Recursive + "/f", "%env.CMAKE_BUILD_FOLDER%") # source folder + & ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags | Tee-Object -file symstore.txt + + ${'$'}stored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}" + ${'$'}stored = ${'$'}stored.Matches.Groups[1].Value + + ${'$'}errors = get-content symstore.txt | Select-String "^SYMSTORE: Number of errors = (.*)${'$'}" + ${'$'}errors = ${'$'}errors.Matches.Groups[1].Value + + ${'$'}ignored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}" + ${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value + + Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']" + """.trimIndent() + } + } } } @@ -228,10 +235,12 @@ class CarbonBuildWindows(buildName: String, configType: String, preset: String, } } } - xmlReport { - reportType = XmlReport.XmlReportType.JUNIT - rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%" - verbose = true + if (enablePch) { + xmlReport { + reportType = XmlReport.XmlReportType.JUNIT + rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%" + verbose = true + } } perfmon { } diff --git a/CMakeLists.txt b/CMakeLists.txt index 14a41fa..3286ed4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,46 @@ set(PUBLIC_HEADER_FILES ) target_sources(CcpCore PRIVATE ${PUBLIC_HEADER_FILES}) -target_precompile_headers(CcpCore PRIVATE StdAfx.h) +# The precompiled header is a build-speed optimisation, not a way to hand +# declarations to every translation unit. Building with -DCCP_ENABLE_PCH=OFF +# proves that each source and header still works without PCH. +option(CCP_ENABLE_PCH "Use a precompiled header to speed up compilation." ON) + +if(CCP_ENABLE_PCH) + target_precompile_headers(CcpCore PRIVATE StdAfx.h) +endif() + +# Every public header must compile on its own, without the PCH and without any +# other header having been included first. Consumers of the installed package get +# no PCH, so a header that only compiles behind one is already broken for them. +# +# Each header gets a generated translation unit that includes it twice, to also +# ensure "#pragma once" is applied correctly. +option(CCP_BUILD_HEADER_SELFTEST "Verify that every public header is self-contained." ON) + +if(CCP_BUILD_HEADER_SELFTEST) + set(HEADER_SELFTEST_SOURCES "") + foreach(_header IN LISTS PUBLIC_HEADER_FILES) + get_filename_component(_header_abs "${_header}" ABSOLUTE) + get_filename_component(_header_name "${_header}" NAME_WE) + set(_selftest_source "${CMAKE_CURRENT_BINARY_DIR}/header_selftest/${_header_name}_selftest.cpp") + file(GENERATE + OUTPUT "${_selftest_source}" + CONTENT "#include \"${_header_abs}\"\n#include \"${_header_abs}\"\n" + ) + list(APPEND HEADER_SELFTEST_SOURCES "${_selftest_source}") + endforeach() + + add_library(CcpCoreHeaderSelftest OBJECT ${HEADER_SELFTEST_SOURCES}) + target_include_directories(CcpCoreHeaderSelftest PRIVATE + $ + ${CMAKE_CURRENT_BINARY_DIR} + ) + target_compile_definitions(CcpCoreHeaderSelftest PRIVATE + $ + ) + set_target_properties(CcpCoreHeaderSelftest PROPERTIES DISABLE_PRECOMPILE_HEADERS ON) +endif() if(APPLE) set_prefix_and_suffix(CcpCore) diff --git a/CcpAssert.cpp b/CcpAssert.cpp index 5edcf3e..7f816b7 100644 --- a/CcpAssert.cpp +++ b/CcpAssert.cpp @@ -4,6 +4,7 @@ #include "include/CcpSecureCrt.h" #ifdef _WIN32 + #include #include #endif diff --git a/CcpCallstack.cpp b/CcpCallstack.cpp index 2d8c726..39c1d9e 100644 --- a/CcpCallstack.cpp +++ b/CcpCallstack.cpp @@ -2,6 +2,8 @@ #include "include/CcpCallstack.h" +#include + namespace { @@ -25,6 +27,8 @@ NB: VS2017 warns about the use of an ill-formed typedef in the file, but that's how it ships inside "Windows Kits\8.1" so guess we're stuck with it. We can, at least, mute the warning... */ +#include + #pragma warning(push) #pragma warning(disable:4091) #include diff --git a/CcpDefines.cpp b/CcpDefines.cpp index 1f00f4d..4917cfd 100644 --- a/CcpDefines.cpp +++ b/CcpDefines.cpp @@ -4,6 +4,8 @@ #include "include/CcpDefines.h" #include "include/CcpMacros.h" +#include + const char* CcpGetPlatformToolset() { return CCP_STRINGIZE( PLATFORM_TOOLSET ); diff --git a/CcpFileUtils.cpp b/CcpFileUtils.cpp index ed59d96..c0902e5 100644 --- a/CcpFileUtils.cpp +++ b/CcpFileUtils.cpp @@ -4,8 +4,11 @@ #include "include/CcpFileUtils.h" #include "include/StringConversions.h" #include "include/CcpSecureCrt.h" +#include "include/CcpLog.h" +#include #include +#include #ifdef _WIN32 diff --git a/CcpHash.cpp b/CcpHash.cpp index 7bfdc25..232c327 100644 --- a/CcpHash.cpp +++ b/CcpHash.cpp @@ -2,6 +2,8 @@ #include "include/CcpHash.h" +#include + /// See http://www.isthe.com/chongo/tech/comp/fnv/ for a description of the FNV1 hash algorithm /// and the specific values used here. diff --git a/CcpLog.cpp b/CcpLog.cpp index 04c372c..2ae36fa 100644 --- a/CcpLog.cpp +++ b/CcpLog.cpp @@ -3,6 +3,7 @@ #include "CcpLog.h" #include +#include #include #include diff --git a/CcpMemory.cpp b/CcpMemory.cpp index c890a0b..ef98c4c 100644 --- a/CcpMemory.cpp +++ b/CcpMemory.cpp @@ -5,6 +5,7 @@ #include "include/CcpAssert.h" #include "include/CcpSecureCrt.h" #include "include/CcpTelemetry.h" +#include "include/CcpLog.h" #include "CcpMemoryTrackerMutex.h" #ifdef __APPLE__ @@ -322,6 +323,8 @@ static inline void CcpPlatformFree( void* p ) #else +#include + std::atomic s_memuse( 0 ); diff --git a/CcpMemoryTracker.cpp b/CcpMemoryTracker.cpp index 9509d72..f74d51b 100644 --- a/CcpMemoryTracker.cpp +++ b/CcpMemoryTracker.cpp @@ -6,6 +6,7 @@ #include "include/CcpMemory.h" #include "include/CcpMutex.h" +#include #include // #define CCP_UNIT_TEST 1 @@ -15,6 +16,7 @@ #include "include/CcpHash.h" #include "include/CcpCallstack.h" #include "include/CcpSecureCrt.h" +#include "include/CcpLog.h" #ifdef _WIN32 #include diff --git a/CcpStatistics.cpp b/CcpStatistics.cpp index 900b18a..5eedd76 100644 --- a/CcpStatistics.cpp +++ b/CcpStatistics.cpp @@ -2,6 +2,9 @@ #include "include/CcpStatistics.h" +#include +#include + #include "CcpTelemetry.h" #if CCP_TELEMETRY_ENABLED diff --git a/CcpTelemetry.cpp b/CcpTelemetry.cpp index 0c618a5..ae9ca7f 100644 --- a/CcpTelemetry.cpp +++ b/CcpTelemetry.cpp @@ -1,5 +1,6 @@ // Copyright © 2013 CCP ehf. +#include #include #include #include @@ -9,6 +10,7 @@ #include "include/CcpAssert.h" #include "include/CcpMutex.h" +#include "include/CcpLog.h" #include "include/CcpTelemetry.h" #include "include/CcpTime.h" diff --git a/CcpTime.cpp b/CcpTime.cpp index ce581c4..620b439 100644 --- a/CcpTime.cpp +++ b/CcpTime.cpp @@ -3,6 +3,7 @@ #include "include/CcpTime.h" #include "include/CcpAssert.h" #include +#include #include #ifdef _WIN32 @@ -112,6 +113,7 @@ uint64_t CcpGetTickCount() #else +#include #include uint64_t CcpGetTimestamp() diff --git a/include/CachedAllocator.h b/include/CachedAllocator.h index 9575385..09db3ce 100644 --- a/include/CachedAllocator.h +++ b/include/CachedAllocator.h @@ -4,6 +4,8 @@ #ifndef CachedAllocator_h #define CachedAllocator_h +#include + #include "CcpMemory.h" // CachedAllocator is a template class that provides cached allocations for its template argument. diff --git a/include/CcpCallstack.h b/include/CcpCallstack.h index 4ccd5e4..6f3506b 100644 --- a/include/CcpCallstack.h +++ b/include/CcpCallstack.h @@ -3,6 +3,9 @@ #ifndef _CCPCALLSTACK_H_ #define _CCPCALLSTACK_H_ +#include +#include + #include "carbon_core_export.h" class CARBON_CORE_API CCPCallstack diff --git a/include/CcpHash.h b/include/CcpHash.h index 481f2d1..70c2851 100644 --- a/include/CcpHash.h +++ b/include/CcpHash.h @@ -5,6 +5,8 @@ #ifndef _CCPHASH_H_ #define _CCPHASH_H_ +#include + #include "carbon_core_export.h" /// See http://www.isthe.com/chongo/tech/comp/fnv/ for a description of the FNV1 hash algorithm. diff --git a/include/CcpLog.h b/include/CcpLog.h index 0727cee..a6ff82a 100644 --- a/include/CcpLog.h +++ b/include/CcpLog.h @@ -5,6 +5,7 @@ #define CCP_LOG_H #include +#include #include #include "carbon_core_export.h" diff --git a/include/CcpMemoryTracker.h b/include/CcpMemoryTracker.h index 78ac355..f4a023a 100644 --- a/include/CcpMemoryTracker.h +++ b/include/CcpMemoryTracker.h @@ -27,6 +27,8 @@ CARBON_CORE_API bool IsCallstackCaptureEnabled(); CARBON_CORE_API void MemoryTrackerSummaryReportToFile( FILE* file ); #ifdef _WIN32 +#include + CARBON_CORE_API size_t GetHeapSizeWithHeapWalk( HANDLE heap ); CARBON_CORE_API HANDLE MemoryTrackerGetHeapForTracking(); #endif diff --git a/include/CcpPairingHeap.h b/include/CcpPairingHeap.h index e8e076d..2677cbf 100644 --- a/include/CcpPairingHeap.h +++ b/include/CcpPairingHeap.h @@ -31,6 +31,8 @@ #include +#include "CcpAssert.h" + //Declarations diff --git a/include/CcpSecureCrt.h b/include/CcpSecureCrt.h index a55574a..7d08d7f 100644 --- a/include/CcpSecureCrt.h +++ b/include/CcpSecureCrt.h @@ -4,10 +4,15 @@ #ifndef CcpSecureCrt_h #define CcpSecureCrt_h -#ifndef _MSC_VER - #include +#include +#include +#include #include +#include + +#ifndef _MSC_VER + #include #include "carbon_core_export.h" diff --git a/include/CcpThread.h b/include/CcpThread.h index 4419977..d3b29cd 100644 --- a/include/CcpThread.h +++ b/include/CcpThread.h @@ -21,6 +21,7 @@ _mm_pause(); } #elif __APPLE__ + #include #include #include typedef mach_port_t CcpThreadId_t; diff --git a/include/ICcpStream.h b/include/ICcpStream.h index 4347c44..5e9a389 100644 --- a/include/ICcpStream.h +++ b/include/ICcpStream.h @@ -4,6 +4,7 @@ #ifndef ICcpStream_H #define ICcpStream_H +#include struct ICcpStream { diff --git a/include/TrackableContainer.h b/include/TrackableContainer.h index 7b28ae4..e5e326e 100644 --- a/include/TrackableContainer.h +++ b/include/TrackableContainer.h @@ -5,11 +5,10 @@ #ifndef TRACKABLECONTAINER_H #define TRACKABLECONTAINER_H +#include + #include "CcpMemory.h" #include "CcpSecureCrt.h" -#ifdef _MSC_VER - #include -#endif template class NamedStdAllocator : public std::allocator {