add support for clang compiler (#592)
* hacks to align strings for clang... wow just wow * start work to getting built with clang * fix issues with struct constructors, all builds, doesn't link still * fix some narrowing issues that clang complains about * fix compliation of zapd * fix null deref in VersionInfo * builds with clang * make stringbuilding use StringHelper instead of addition * fix linking * add CLANG SHIP overlay on clang built versions * doesn't need to be volatile * mark unknown strings as extern * rename some stuff * can't align extern * hopefully fix compilation for everythign * expandtab * allow setting LD * Revert "allow setting LD" This reverts commit 711aba6db2c41bab476bd34e878af6a37a7f5559. maybe to use lld it should be a LDFLAG? * -Wno-deprecated-declarations is required for newer versions of clang on macOS 13 beta sdk, the version of apple clang requires this * Add jenkins support for clang * Forward CXX flags to stormlib compilation * Move GCC only flags to check * use exports to set multiarch setup * Fix Jenkins forever * use make instead of cmake --build add some flags to build with clang-11 as well * address review coments - rework extraction to allow multi thread - misc readability cleanup * update makefile to add WARN on linux+clang Co-authored-by: David Chavez <david@dcvz.io>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "WarningHandler.h"
|
||||
#include "ZFile.h"
|
||||
#include <Globals.h>
|
||||
#include <set>
|
||||
#include <ZDisplayList.h>
|
||||
#include <ZArray.h>
|
||||
|
||||
@@ -304,7 +305,7 @@ void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
|
||||
}
|
||||
}
|
||||
|
||||
std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
|
||||
std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, std::set<std::string> *nameSet)
|
||||
{
|
||||
if (Globals::Instance->otrMode && genOTRDef)
|
||||
{
|
||||
@@ -342,9 +343,20 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string&
|
||||
prefix = "text";
|
||||
|
||||
if (prefix != "")
|
||||
str += StringHelper::Sprintf("#define %s \"__OTR__%s/%s/%s\"", name.c_str(), prefix.c_str(), outName.c_str(), nameStr.c_str());
|
||||
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s/%s\"", name.c_str(), prefix.c_str(), outName.c_str(), nameStr.c_str());
|
||||
else
|
||||
str += StringHelper::Sprintf("#define %s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
|
||||
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
|
||||
|
||||
if (nameSet && nameSet->find(name) == nameSet->end()) {
|
||||
#ifdef _WIN32
|
||||
str += StringHelper::Sprintf("\nstatic const __declspec(align(2)) char %s[] = d%s;", name.c_str(), name.c_str());
|
||||
#else
|
||||
str += StringHelper::Sprintf("\nstatic const char %s[] __attribute__((aligned (2))) = d%s;", name.c_str(), name.c_str());
|
||||
#endif
|
||||
if (nameSet) {
|
||||
nameSet->insert(name);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user