Fix headers for XML/XMB

Declare "lib/posix/posix.h" as source for <strings.h>

Make include-what-you-use happy with files in source/ps/{XMB,XML} and
fix what needs to be fixed after including missing compile flags.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2025-06-20 00:06:41 +02:00
parent 758d901883
commit a606fbf1a5
12 changed files with 106 additions and 43 deletions
+9
View File
@@ -691,6 +691,8 @@ function setup_all_libs ()
"sdl",
"boost", -- dragged in via server->simulation.h->random and NetSession.h->lockfree
"fmt",
"libxml2",
"iconv",
}
if not _OPTIONS["without-miniupnpc"] then
table.insert(extern_libs, "miniupnpc")
@@ -780,6 +782,8 @@ function setup_all_libs ()
"boost",
"spidermonkey",
"fmt",
"libxml2",
"iconv",
}
setup_static_lib_project("simulation2", source_dirs, extern_libs, {})
@@ -861,6 +865,8 @@ function setup_all_libs ()
"fmt",
"freetype",
"icu",
"libxml2",
"iconv",
}
if not _OPTIONS["without-nvtt"] then
table.insert(extern_libs, "nvtt")
@@ -877,6 +883,8 @@ function setup_all_libs ()
"sdl", -- key definitions
"spidermonkey",
"fmt",
"libxml2",
"iconv",
}
setup_static_lib_project("atlas", source_dirs, extern_libs, {})
@@ -898,6 +906,7 @@ function setup_all_libs ()
"icu",
"iconv",
"fmt",
"libxml2",
}
if not _OPTIONS["without-audio"] then
table.insert(extern_libs, "openal")
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -93,6 +93,8 @@ need only be renamed (e.g. _open, _stat).
#define strncasecmp _strnicmp
#define wcscasecmp _wcsicmp
#define wcsncasecmp _wcsnicmp
#else
#include <strings.h> // IWYU pragma: export
#endif
#if OS_MACOSX
+10 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -17,9 +17,16 @@
#include "precompiled.h"
#include "lib/byte_order.h" // FOURCC_LE
#include "XMBData.h"
#include "lib/debug.h"
#include "lib/posix/posix.h"
#include "lib/secure_crt.h"
#include "lib/types.h"
#include "ps/XMB/XMBStorage.h"
#include "ps/XML/Xeromyces.h"
#include <cstring>
#include <memory>
template<typename T>
static inline T read(const void* ptr)
+5 -6
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -82,15 +82,14 @@ XMB_Text {
#include "ps/CStr.h"
#include <string>
#include <cstddef>
#include <iterator>
#include <string_view>
class XMBStorage;
class XMBAttributeList;
class XMBElement;
class XMBElementList;
class XMBAttributeList;
class XMBStorage;
class XMBData
{
+15 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,17 +19,30 @@
#include "XMBStorage.h"
#include "lib/debug.h"
#include "lib/file/io/write_buffer.h"
#include "lib/file/vfs/vfs.h"
#include "ps/CLogger.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptRequest.h"
#include <algorithm>
#include <iterator>
#include <js/Array.h>
#include <js/PropertyAndElement.h>
#include <js/RootingAPI.h>
#include <js/Value.h>
#include <jsapi.h>
#include <jspubtd.h>
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
#include <libxml/xmlstring.h>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
const char* XMBStorage::HeaderMagicStr = "XMB0";
const char* XMBStorage::UnfinishedHeaderMagicStr = "XMBu";
+8 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,15 @@
#ifndef INCLUDED_XMBSTORAGE
#define INCLUDED_XMBSTORAGE
#include "scriptinterface/ScriptForward.h"
#include "lib/types.h"
#include <cstddef>
#include <js/TypeDecls.h>
#include <libxml/parser.h>
#include <memory>
#include <string>
class ScriptInterface;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc* xmlDocPtr;
+8 -1
View File
@@ -19,17 +19,24 @@
#include "RelaxNG.h"
#include "lib/code_annotation.h"
#include "lib/timer.h"
#include "lib/utf8.h"
#include "lib/types.h"
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include "ps/Errors.h"
#include "ps/Filesystem.h"
#include <cstddef>
#include <libxml/parser.h>
#include <libxml/relaxng.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlversion.h>
#include <map>
#include <memory>
#include <mutex>
#include <type_traits>
#include <utility>
TIMER_ADD_CLIENT(xml_validation);
+5 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,8 +19,12 @@
#define INCLUDED_RELAXNG
#include "lib/file/vfs/vfs.h"
#include "lib/file/vfs/vfs_path.h"
#include "maths/MD5.h"
#include <libxml/parser.h>
#include <string>
typedef struct _xmlRelaxNG xmlRelaxNG;
typedef xmlRelaxNG *xmlRelaxNGPtr;
typedef struct _xmlDoc xmlDoc;
+15 -6
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,14 +19,23 @@
#include "XMLWriter.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/XML/Xeromyces.h"
#include "lib/utf8.h"
#include "lib/alignment.h"
#include "lib/allocators/shared_ptr.h"
#include "lib/sysdep/cpu.h"
#include "lib/debug.h"
#include "lib/path.h"
#include "lib/status.h"
#include "lib/types.h"
#include "lib/utf8.h"
#include "maths/Fixed.h"
#include "ps/CLogger.h"
#include "ps/XMB/XMBData.h"
#include "ps/XMB/XMBStorage.h"
#include "ps/XML/Xeromyces.h"
#include <cstring>
#include <memory>
#include <sstream>
#include <string>
// TODO (maybe): Write to the file frequently, instead of buffering
// the entire file, so that large files get written faster.
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -62,6 +62,7 @@
*/
#include "lib/file/vfs/vfs.h"
#include "lib/file/vfs/vfs_path.h"
#include "ps/CStr.h"
class XMBElement;
+19 -13
View File
@@ -17,23 +17,29 @@
#include "precompiled.h"
#include <vector>
#include <set>
#include <map>
#include <mutex>
#include <stack>
#include <algorithm>
#include "maths/MD5.h"
#include "ps/CacheLoader.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "RelaxNG.h"
#include "Xeromyces.h"
#include "RelaxNG.h"
#include "lib/code_annotation.h"
#include "lib/debug.h"
#include "lib/file/vfs/vfs.h"
#include "lib/path.h"
#include "lib/status.h"
#include "maths/MD5.h"
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include "ps/CacheLoader.h"
#include "ps/Filesystem.h"
#include <cstring>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlversion.h>
#include <map>
#include <memory>
#include <mutex>
#include <type_traits>
#include <utility>
static std::mutex g_ValidatorCacheLock;
static std::map<const std::string, RelaxNGValidator> g_ValidatorCache;
+7 -7
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -25,19 +25,19 @@
#define INCLUDED_XEROMYCES
#include "ps/Errors.h"
ERROR_GROUP(Xeromyces);
ERROR_TYPE(Xeromyces, XMLOpenFailed);
ERROR_TYPE(Xeromyces, XMLParseError);
ERROR_TYPE(Xeromyces, XMLValidationFailed);
#include "ps/Singleton.h"
#include "ps/XMB/XMBData.h"
#include "ps/XMB/XMBStorage.h"
#include "lib/file/vfs/vfs.h"
#include <string>
class RelaxNGValidator;
ERROR_GROUP(Xeromyces);
ERROR_TYPE(Xeromyces, XMLOpenFailed);
ERROR_TYPE(Xeromyces, XMLParseError);
ERROR_TYPE(Xeromyces, XMLValidationFailed);
class CXeromyces : public XMBData
{
friend class TestXMBData;