mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Consistently format type qualifiers like const on the right (#1347)
This commit is contained in:
@@ -69,6 +69,7 @@ MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
PPIndentWidth: -1
|
||||
PointerAlignment: Right
|
||||
QualifierAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: CaseSensitive
|
||||
SortUsingDeclarations: true
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
struct Expression;
|
||||
struct FileStackNode;
|
||||
|
||||
extern const char *objectName;
|
||||
extern char const *objectName;
|
||||
|
||||
void out_RegisterNode(FileStackNode *node);
|
||||
void out_ReplaceNode(FileStackNode *node);
|
||||
|
||||
@@ -27,7 +27,7 @@ struct Expression {
|
||||
Expression(Expression &&) = default;
|
||||
#ifdef _MSC_VER
|
||||
// MSVC and WinFlexBison won't build without this...
|
||||
Expression(const Expression &) = default;
|
||||
Expression(Expression const &) = default;
|
||||
#endif
|
||||
|
||||
Expression &operator=(Expression &&) = default;
|
||||
@@ -36,10 +36,10 @@ struct Expression {
|
||||
void rpn_Number(Expression &expr, uint32_t val);
|
||||
void rpn_Symbol(Expression &expr, char const *symName);
|
||||
void rpn_LOGNOT(Expression &expr, Expression &&src);
|
||||
void rpn_BinaryOp(RPNCommand op, Expression &expr, Expression &&src1, const Expression &src2);
|
||||
void rpn_BinaryOp(RPNCommand op, Expression &expr, Expression &&src1, Expression const &src2);
|
||||
void rpn_HIGH(Expression &expr, Expression &&src);
|
||||
void rpn_LOW(Expression &expr, Expression &&src);
|
||||
void rpn_ISCONST(Expression &expr, const Expression &src);
|
||||
void rpn_ISCONST(Expression &expr, Expression const &src);
|
||||
void rpn_NEG(Expression &expr, Expression &&src);
|
||||
void rpn_NOT(Expression &expr, Expression &&src);
|
||||
void rpn_BankSymbol(Expression &expr, char const *symName);
|
||||
@@ -52,6 +52,6 @@ void rpn_StartOfSectionType(Expression &expr, SectionType type);
|
||||
|
||||
void rpn_CheckHRAM(Expression &expr);
|
||||
void rpn_CheckRST(Expression &expr);
|
||||
void rpn_CheckNBit(const Expression &expr, uint8_t n);
|
||||
void rpn_CheckNBit(Expression const &expr, uint8_t n);
|
||||
|
||||
#endif // RGBDS_ASM_RPN_H
|
||||
|
||||
2
include/extern/getopt.hpp
vendored
2
include/extern/getopt.hpp
vendored
@@ -18,7 +18,7 @@ struct option {
|
||||
};
|
||||
|
||||
int musl_getopt_long_only(
|
||||
int argc, char **argv, char const *optstring, const option *longopts, int *idx
|
||||
int argc, char **argv, char const *optstring, option const *longopts, int *idx
|
||||
);
|
||||
|
||||
#define no_argument 0
|
||||
|
||||
@@ -38,7 +38,7 @@ size_t maxRecursionDepth;
|
||||
// The first include path for `fstk_FindFile` to try is none at all
|
||||
static std::vector<std::string> includePaths = {""};
|
||||
|
||||
static const char *preIncludeName;
|
||||
static char const *preIncludeName;
|
||||
|
||||
std::vector<uint32_t> &FileStackNode::iters() {
|
||||
assert(std::holds_alternative<std::vector<uint32_t>>(data));
|
||||
@@ -60,7 +60,7 @@ std::string const &FileStackNode::name() const {
|
||||
return std::get<std::string>(data);
|
||||
}
|
||||
|
||||
static const char *dumpNodeAndParents(FileStackNode const &node) {
|
||||
static char const *dumpNodeAndParents(FileStackNode const &node) {
|
||||
char const *name;
|
||||
|
||||
if (node.type == NODE_REPT) {
|
||||
|
||||
@@ -77,7 +77,7 @@ static std::string make_escape(std::string &str) {
|
||||
}
|
||||
|
||||
// Short options
|
||||
static const char *optstring = "b:D:Eg:Hhi:I:LlM:o:P:p:Q:r:VvW:wX:";
|
||||
static char const *optstring = "b:D:Eg:Hhi:I:LlM:o:P:p:Q:r:VvW:wX:";
|
||||
|
||||
// Variables for the long-only options
|
||||
static int depType; // Variants of `-M`
|
||||
@@ -279,7 +279,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
unsigned long precision;
|
||||
const char *precisionArg;
|
||||
char const *precisionArg;
|
||||
case 'Q':
|
||||
precisionArg = musl_optarg;
|
||||
if (precisionArg[0] == '.')
|
||||
|
||||
@@ -106,7 +106,7 @@ void opt_Parse(char const *s) {
|
||||
}
|
||||
break;
|
||||
|
||||
const char *precisionArg;
|
||||
char const *precisionArg;
|
||||
case 'Q':
|
||||
precisionArg = &s[1];
|
||||
if (precisionArg[0] == '.')
|
||||
|
||||
@@ -29,7 +29,7 @@ struct Assertion {
|
||||
std::string message;
|
||||
};
|
||||
|
||||
const char *objectName;
|
||||
char const *objectName;
|
||||
|
||||
// List of symbols to put in the object file
|
||||
static std::vector<Symbol *> objectSymbols;
|
||||
@@ -159,7 +159,7 @@ static uint32_t getSymbolID(Symbol &sym) {
|
||||
return sym.ID;
|
||||
}
|
||||
|
||||
static void writerpn(std::vector<uint8_t> &rpnexpr, const std::vector<uint8_t> &rpn) {
|
||||
static void writerpn(std::vector<uint8_t> &rpnexpr, std::vector<uint8_t> const &rpn) {
|
||||
std::string symName;
|
||||
size_t rpnptr = 0;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
StrFmtArgList(StrFmtArgList &&) = default;
|
||||
#ifdef _MSC_VER
|
||||
// MSVC and WinFlexBison won't build without this...
|
||||
StrFmtArgList(const StrFmtArgList &) = default;
|
||||
StrFmtArgList(StrFmtArgList const &) = default;
|
||||
#endif
|
||||
|
||||
StrFmtArgList &operator=(StrFmtArgList &&) = default;
|
||||
@@ -73,7 +73,7 @@
|
||||
static void upperstring(char *dest, char const *src);
|
||||
static void lowerstring(char *dest, char const *src);
|
||||
static uint32_t str2int2(std::vector<uint8_t> const &s);
|
||||
static const char *strrstr(char const *s1, char const *s2);
|
||||
static char const *strrstr(char const *s1, char const *s2);
|
||||
static void errorInvalidUTF8Byte(uint8_t byte, char const *functionName);
|
||||
static size_t strlenUTF8(char const *s);
|
||||
static void strsubUTF8(char *dest, size_t destLen, char const *src, uint32_t pos, uint32_t len);
|
||||
@@ -84,10 +84,12 @@
|
||||
char *dest, size_t destLen, char const *src, char const *old, char const *rep
|
||||
);
|
||||
static void strfmt(
|
||||
char *dest, size_t destLen, char const *spec,
|
||||
char *dest,
|
||||
size_t destLen,
|
||||
char const *spec,
|
||||
std::vector<std::variant<uint32_t, std::string>> &args
|
||||
);
|
||||
static void compoundAssignment(const char *symName, RPNCommand op, int32_t constValue);
|
||||
static void compoundAssignment(char const *symName, RPNCommand op, int32_t constValue);
|
||||
static void failAssert(AssertionType type);
|
||||
static void failAssertMsg(AssertionType type, char const *msg);
|
||||
|
||||
@@ -628,7 +630,7 @@ assignment:
|
||||
sym_AddVar($1.c_str(), $3);
|
||||
}
|
||||
| LABEL compoundeq const {
|
||||
const char *compoundEqOperator = nullptr;
|
||||
char const *compoundEqOperator = nullptr;
|
||||
switch ($2) {
|
||||
case RPN_ADD: compoundEqOperator = "+="; break;
|
||||
case RPN_SUB: compoundEqOperator = "-="; break;
|
||||
@@ -2471,7 +2473,8 @@ static uint32_t str2int2(std::vector<uint8_t> const &s) {
|
||||
if (length > 4)
|
||||
warning(
|
||||
WARNING_NUMERIC_STRING_1,
|
||||
"Treating string as a number ignores first %" PRIu32 " character%s\n", length - 4,
|
||||
"Treating string as a number ignores first %" PRIu32 " character%s\n",
|
||||
length - 4,
|
||||
length == 5 ? "" : "s"
|
||||
);
|
||||
else if (length > 1)
|
||||
@@ -2489,7 +2492,7 @@ static uint32_t str2int2(std::vector<uint8_t> const &s) {
|
||||
return r;
|
||||
}
|
||||
|
||||
static const char *strrstr(char const *s1, char const *s2) {
|
||||
static char const *strrstr(char const *s1, char const *s2) {
|
||||
size_t len1 = strlen(s1);
|
||||
size_t len2 = strlen(s2);
|
||||
|
||||
@@ -2605,7 +2608,8 @@ static void charsubUTF8(char *dest, char const *src, uint32_t pos) {
|
||||
|
||||
if (!charmap_ConvertNext(src, nullptr))
|
||||
warning(
|
||||
WARNING_BUILTIN_ARG, "CHARSUB: Position %" PRIu32 " is past the end of the string\n",
|
||||
WARNING_BUILTIN_ARG,
|
||||
"CHARSUB: Position %" PRIu32 " is past the end of the string\n",
|
||||
pos
|
||||
);
|
||||
|
||||
@@ -2672,7 +2676,9 @@ static void strrpl(char *dest, size_t destLen, char const *src, char const *old,
|
||||
}
|
||||
|
||||
static void strfmt(
|
||||
char *dest, size_t destLen, char const *spec,
|
||||
char *dest,
|
||||
size_t destLen,
|
||||
char const *spec,
|
||||
std::vector<std::variant<uint32_t, std::string>> &args
|
||||
) {
|
||||
size_t a = 0;
|
||||
@@ -2748,7 +2754,7 @@ static void strfmt(
|
||||
dest[i] = '\0';
|
||||
}
|
||||
|
||||
static void compoundAssignment(const char *symName, RPNCommand op, int32_t constValue) {
|
||||
static void compoundAssignment(char const *symName, RPNCommand op, int32_t constValue) {
|
||||
Expression oldExpr, constExpr, newExpr;
|
||||
int32_t newValue;
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ void rpn_CheckRST(Expression &expr) {
|
||||
}
|
||||
|
||||
// Checks that an RPN expression's value fits within N bits (signed or unsigned)
|
||||
void rpn_CheckNBit(const Expression &expr, uint8_t n) {
|
||||
void rpn_CheckNBit(Expression const &expr, uint8_t n) {
|
||||
assert(n != 0); // That doesn't make sense
|
||||
assert(n < CHAR_BIT * sizeof(int)); // Otherwise `1 << n` is UB
|
||||
|
||||
@@ -324,7 +324,7 @@ static int32_t tryConstMask(Expression const &lhs, Expression const &rhs) {
|
||||
return (symbolOfs + sect.alignOfs) & ~unknownBits;
|
||||
}
|
||||
|
||||
void rpn_BinaryOp(RPNCommand op, Expression &expr, Expression &&src1, const Expression &src2) {
|
||||
void rpn_BinaryOp(RPNCommand op, Expression &expr, Expression &&src1, Expression const &src2) {
|
||||
initExpression(expr);
|
||||
expr.isSymbol = false;
|
||||
int32_t constMaskVal;
|
||||
@@ -570,7 +570,7 @@ void rpn_LOW(Expression &expr, Expression &&src) {
|
||||
}
|
||||
}
|
||||
|
||||
void rpn_ISCONST(Expression &expr, const Expression &src) {
|
||||
void rpn_ISCONST(Expression &expr, Expression const &src) {
|
||||
initExpression(expr);
|
||||
expr.val = src.isKnown;
|
||||
expr.isKnown = true;
|
||||
|
||||
@@ -589,7 +589,7 @@ void sym_Init(time_t now) {
|
||||
now = 0;
|
||||
}
|
||||
|
||||
const tm *time_local = localtime(&now);
|
||||
tm const *time_local = localtime(&now);
|
||||
|
||||
strftime(savedTIME, sizeof(savedTIME), "\"%H:%M:%S\"", time_local);
|
||||
strftime(savedDATE, sizeof(savedDATE), "\"%d %B %Y\"", time_local);
|
||||
@@ -600,7 +600,7 @@ void sym_Init(time_t now) {
|
||||
time_local
|
||||
);
|
||||
|
||||
const tm *time_utc = gmtime(&now);
|
||||
tm const *time_utc = gmtime(&now);
|
||||
|
||||
strftime(
|
||||
savedTIMESTAMP_ISO8601_UTC,
|
||||
|
||||
@@ -67,7 +67,7 @@ static WarningState warningState(WarningID id) {
|
||||
return state;
|
||||
}
|
||||
|
||||
static const char * const warningFlags[NB_WARNINGS] = {
|
||||
static char const * const warningFlags[NB_WARNINGS] = {
|
||||
"assert",
|
||||
"backwards-for",
|
||||
"builtin-args",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <string.h>
|
||||
|
||||
static void vwarn(char const *fmt, va_list ap) {
|
||||
const char *error = strerror(errno);
|
||||
char const *error = strerror(errno);
|
||||
|
||||
fprintf(stderr, "warning: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
@@ -23,7 +23,7 @@ static void vwarnx(char const *fmt, va_list ap) {
|
||||
}
|
||||
|
||||
[[noreturn]] static void verr(char const *fmt, va_list ap) {
|
||||
const char *error = strerror(errno);
|
||||
char const *error = strerror(errno);
|
||||
|
||||
fprintf(stderr, "error: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
|
||||
8
src/extern/getopt.cpp
vendored
8
src/extern/getopt.cpp
vendored
@@ -114,11 +114,11 @@ static void permute(char **argv, int dest, int src) {
|
||||
}
|
||||
|
||||
static int musl_getopt_long_core(
|
||||
int argc, char **argv, char const *optstring, const option *longopts, int *idx, int longonly
|
||||
int argc, char **argv, char const *optstring, option const *longopts, int *idx, int longonly
|
||||
);
|
||||
|
||||
static int musl_getopt_long(
|
||||
int argc, char **argv, char const *optstring, const option *longopts, int *idx, int longonly
|
||||
int argc, char **argv, char const *optstring, option const *longopts, int *idx, int longonly
|
||||
) {
|
||||
int ret, skipped, resumed;
|
||||
|
||||
@@ -155,7 +155,7 @@ static int musl_getopt_long(
|
||||
}
|
||||
|
||||
static int musl_getopt_long_core(
|
||||
int argc, char **argv, char const *optstring, const option *longopts, int *idx, int longonly
|
||||
int argc, char **argv, char const *optstring, option const *longopts, int *idx, int longonly
|
||||
) {
|
||||
musl_optarg = 0;
|
||||
if (longopts && argv[musl_optind][0] == '-'
|
||||
@@ -260,7 +260,7 @@ static int musl_getopt_long_core(
|
||||
}
|
||||
|
||||
int musl_getopt_long_only(
|
||||
int argc, char **argv, char const *optstring, const option *longopts, int *idx
|
||||
int argc, char **argv, char const *optstring, option const *longopts, int *idx
|
||||
) {
|
||||
return musl_getopt_long(argc, argv, optstring, longopts, idx, 1);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define BANK_SIZE 0x4000
|
||||
|
||||
// Short options
|
||||
static const char *optstring = "Ccf:i:jk:l:m:n:Op:r:st:Vv";
|
||||
static char const *optstring = "Ccf:i:jk:l:m:n:Op:r:st:Vv";
|
||||
|
||||
/*
|
||||
* Equivalent long options
|
||||
@@ -754,10 +754,10 @@ static enum { DMG, BOTH, CGB } model = DMG; // If DMG, byte is left alone
|
||||
#define FIX_GLOBAL_SUM 0x08
|
||||
#define TRASH_GLOBAL_SUM 0x04
|
||||
static uint8_t fixSpec = 0;
|
||||
static const char *gameID = nullptr;
|
||||
static char const *gameID = nullptr;
|
||||
static uint8_t gameIDLen;
|
||||
static bool japanese = true;
|
||||
static const char *newLicensee = nullptr;
|
||||
static char const *newLicensee = nullptr;
|
||||
static uint8_t newLicenseeLen;
|
||||
static uint16_t oldLicensee = UNSPECIFIED;
|
||||
static MbcType cartridgeType = MBC_NONE;
|
||||
@@ -766,7 +766,7 @@ static bool overwriteRom = false; // If false, warn when overwriting non-zero no
|
||||
static uint16_t padValue = UNSPECIFIED;
|
||||
static uint16_t ramSize = UNSPECIFIED;
|
||||
static bool sgb = false; // If false, SGB flags are left alone
|
||||
static const char *title = nullptr;
|
||||
static char const *title = nullptr;
|
||||
static uint8_t titleLen;
|
||||
|
||||
static uint8_t maxTitleLen() {
|
||||
|
||||
@@ -789,7 +789,7 @@ int main(int argc, char *argv[]) {
|
||||
}());
|
||||
if (options.palSpecType == Options::EXPLICIT) {
|
||||
fputs("\t[\n", stderr);
|
||||
for (const auto &pal : options.palSpec) {
|
||||
for (auto const &pal : options.palSpec) {
|
||||
fputs("\t\t", stderr);
|
||||
for (auto &color : pal) {
|
||||
if (color) {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <stdio.h>
|
||||
#include <streambuf>
|
||||
#include <string.h>
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "gfx/main.hpp"
|
||||
|
||||
static DefaultInitVec<uint8_t> readInto(const std::string &path) {
|
||||
static DefaultInitVec<uint8_t> readInto(std::string const &path) {
|
||||
File file;
|
||||
if (!file.open(path, std::ios::in | std::ios::binary)) {
|
||||
fatal("Failed to open \"%s\": %s", file.c_str(path), strerror(errno));
|
||||
|
||||
@@ -150,7 +150,7 @@ void argErr(char flag, char const *fmt, ...) {
|
||||
}
|
||||
|
||||
// Short options
|
||||
static const char *optstring = "dl:m:Mn:O:o:p:S:s:tVvWwx";
|
||||
static char const *optstring = "dl:m:Mn:O:o:p:S:s:tVvWwx";
|
||||
|
||||
/*
|
||||
* Equivalent long options
|
||||
|
||||
@@ -145,8 +145,7 @@ optional:
|
||||
0, \
|
||||
"%s(%" PRIu32 "): " fmt, \
|
||||
context.path.c_str(), \
|
||||
context.lineNo __VA_OPT__(, ) \
|
||||
__VA_ARGS__ \
|
||||
context.lineNo __VA_OPT__(, ) __VA_ARGS__ \
|
||||
)
|
||||
|
||||
// Lexer.
|
||||
@@ -406,14 +405,20 @@ static void setSectionType(SectionType type, uint32_t bank) {
|
||||
|
||||
if (bank < typeInfo.firstBank) {
|
||||
scriptError(
|
||||
context, "%s bank %" PRIu32 " doesn't exist (the minimum is %" PRIu32 ")",
|
||||
typeInfo.name.c_str(), bank, typeInfo.firstBank
|
||||
context,
|
||||
"%s bank %" PRIu32 " doesn't exist (the minimum is %" PRIu32 ")",
|
||||
typeInfo.name.c_str(),
|
||||
bank,
|
||||
typeInfo.firstBank
|
||||
);
|
||||
bank = typeInfo.firstBank;
|
||||
} else if (bank > typeInfo.lastBank) {
|
||||
scriptError(
|
||||
context, "%s bank %" PRIu32 " doesn't exist (the maximum is %" PRIu32 ")",
|
||||
typeInfo.name.c_str(), bank, typeInfo.lastBank
|
||||
context,
|
||||
"%s bank %" PRIu32 " doesn't exist (the maximum is %" PRIu32 ")",
|
||||
typeInfo.name.c_str(),
|
||||
bank,
|
||||
typeInfo.lastBank
|
||||
);
|
||||
}
|
||||
|
||||
@@ -434,8 +439,11 @@ static void setAddr(uint32_t addr) {
|
||||
scriptError(context, "Cannot decrease the current address (from $%04x to $%04x)", pc, addr);
|
||||
} else if (addr > endaddr(activeType)) { // Allow "one past the end" sections.
|
||||
scriptError(
|
||||
context, "Cannot set the current address to $%04" PRIx32 ": %s ends at $%04" PRIx16 "",
|
||||
addr, typeInfo.name.c_str(), endaddr(activeType)
|
||||
context,
|
||||
"Cannot set the current address to $%04" PRIx32 ": %s ends at $%04" PRIx16 "",
|
||||
addr,
|
||||
typeInfo.name.c_str(),
|
||||
endaddr(activeType)
|
||||
);
|
||||
pc = endaddr(activeType);
|
||||
} else {
|
||||
@@ -476,7 +484,8 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
|
||||
context,
|
||||
"Cannot align: The alignment offset (%" PRIu32
|
||||
") must be less than alignment size (%" PRIu32 ")",
|
||||
alignOfs, alignSize
|
||||
alignOfs,
|
||||
alignSize
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -508,7 +517,8 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
|
||||
context,
|
||||
"Cannot align: The alignment offset (%" PRIu32
|
||||
") must be less than alignment size (%" PRIu32 ")",
|
||||
alignOfs, alignSize
|
||||
alignOfs,
|
||||
alignSize
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -522,7 +532,9 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
|
||||
context,
|
||||
"Cannot align: the next suitable address after $%04" PRIx16 " is $%04" PRIx16
|
||||
", past $%04" PRIx16,
|
||||
pc, (uint16_t)(pc + length), (uint16_t)(endaddr(activeType) + 1)
|
||||
pc,
|
||||
(uint16_t)(pc + length),
|
||||
(uint16_t)(endaddr(activeType) + 1)
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -549,8 +561,10 @@ static void pad(uint32_t length) {
|
||||
if (uint16_t offset = pc - typeInfo.startAddr; length + offset > typeInfo.size) {
|
||||
scriptError(
|
||||
context,
|
||||
"Cannot increase the current address by %u bytes: only %u bytes to $%04" PRIx16, length,
|
||||
typeInfo.size - offset, (uint16_t)(endaddr(activeType) + 1)
|
||||
"Cannot increase the current address by %u bytes: only %u bytes to $%04" PRIx16,
|
||||
length,
|
||||
typeInfo.size - offset,
|
||||
(uint16_t)(endaddr(activeType) + 1)
|
||||
);
|
||||
} else {
|
||||
pc += length;
|
||||
@@ -584,8 +598,11 @@ static void placeSection(std::string const &name, bool isOptional) {
|
||||
}
|
||||
} else if (section->type != activeType) {
|
||||
scriptError(
|
||||
context, "\"%s\" is specified to be a %s section, but it is already a %s section",
|
||||
name.c_str(), typeInfo.name.c_str(), sectionTypeInfo[section->type].name.c_str()
|
||||
context,
|
||||
"\"%s\" is specified to be a %s section, but it is already a %s section",
|
||||
name.c_str(),
|
||||
typeInfo.name.c_str(),
|
||||
sectionTypeInfo[section->type].name.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -595,7 +612,10 @@ static void placeSection(std::string const &name, bool isOptional) {
|
||||
context,
|
||||
"The linker script places section \"%s\" in %s bank %" PRIu32
|
||||
", but it was already defined in bank %" PRIu32,
|
||||
name.c_str(), sectionTypeInfo[section->type].name.c_str(), bank, section->bank
|
||||
name.c_str(),
|
||||
sectionTypeInfo[section->type].name.c_str(),
|
||||
bank,
|
||||
section->bank
|
||||
);
|
||||
}
|
||||
section->isBankFixed = true;
|
||||
@@ -608,7 +628,9 @@ static void placeSection(std::string const &name, bool isOptional) {
|
||||
context,
|
||||
"The linker script assigns section \"%s\" to address $%04" PRIx16
|
||||
", but it was already at $%04" PRIx16,
|
||||
name.c_str(), org, section->org
|
||||
name.c_str(),
|
||||
org,
|
||||
section->org
|
||||
);
|
||||
} else if (section->isAlignFixed && (org & section->alignMask) != section->alignOfs) {
|
||||
uint8_t alignment = std::countr_one(section->alignMask);
|
||||
@@ -617,7 +639,11 @@ static void placeSection(std::string const &name, bool isOptional) {
|
||||
"The linker script assigns section \"%s\" to address $%04" PRIx16
|
||||
", but that would be ALIGN[%" PRIu8 ", %" PRIu16
|
||||
"] instead of the requested ALIGN[%" PRIu8 ", %" PRIu16 "]",
|
||||
name.c_str(), org, alignment, (uint16_t)(org & section->alignMask), alignment,
|
||||
name.c_str(),
|
||||
org,
|
||||
alignment,
|
||||
(uint16_t)(org & section->alignMask),
|
||||
alignment,
|
||||
section->alignOfs
|
||||
);
|
||||
}
|
||||
@@ -632,7 +658,11 @@ static void placeSection(std::string const &name, bool isOptional) {
|
||||
context,
|
||||
"The linker script assigns section \"%s\" to address $%04" PRIx16
|
||||
", but then it would overflow %s by %" PRIu16 " byte%s",
|
||||
name.c_str(), org, typeInfo.name.c_str(), overflowSize, overflowSize == 1 ? "" : "s"
|
||||
name.c_str(),
|
||||
org,
|
||||
typeInfo.name.c_str(),
|
||||
overflowSize,
|
||||
overflowSize == 1 ? "" : "s"
|
||||
);
|
||||
// Fill as much as possible without going out of bounds.
|
||||
org = typeInfo.startAddr + typeInfo.size;
|
||||
|
||||
Reference in New Issue
Block a user