mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Add braces inside #define macro bodies
This commit is contained in:
@@ -27,8 +27,9 @@ static inline void unreachable_() {
|
|||||||
// `[[gnu::assume()]]` for GCC or compatible also has insufficient support (GCC 13+ only)
|
// `[[gnu::assume()]]` for GCC or compatible also has insufficient support (GCC 13+ only)
|
||||||
#define assume(x) \
|
#define assume(x) \
|
||||||
do { \
|
do { \
|
||||||
if (!(x)) \
|
if (!(x)) { \
|
||||||
unreachable_(); \
|
unreachable_(); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ extern bool disablePadding;
|
|||||||
// Helper macro for printing verbose-mode messages
|
// Helper macro for printing verbose-mode messages
|
||||||
#define verbosePrint(...) \
|
#define verbosePrint(...) \
|
||||||
do { \
|
do { \
|
||||||
if (beVerbose) \
|
if (beVerbose) { \
|
||||||
fprintf(stderr, __VA_ARGS__); \
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
struct FileStackNode {
|
struct FileStackNode {
|
||||||
|
|||||||
@@ -245,8 +245,9 @@ static MbcType parseMBC(char const *name) {
|
|||||||
|
|
||||||
#define tryReadSlice(expected) \
|
#define tryReadSlice(expected) \
|
||||||
do { \
|
do { \
|
||||||
if (!readMBCSlice(ptr, expected)) \
|
if (!readMBCSlice(ptr, expected)) { \
|
||||||
return MBC_BAD; \
|
return MBC_BAD; \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
switch (*ptr++) {
|
switch (*ptr++) {
|
||||||
@@ -1313,8 +1314,9 @@ int main(int argc, char *argv[]) {
|
|||||||
switch (*musl_optarg) {
|
switch (*musl_optarg) {
|
||||||
#define OVERRIDE_SPEC(cur, bad, curFlag, badFlag) \
|
#define OVERRIDE_SPEC(cur, bad, curFlag, badFlag) \
|
||||||
case STR(cur)[0]: \
|
case STR(cur)[0]: \
|
||||||
if (fixSpec & badFlag) \
|
if (fixSpec & badFlag) { \
|
||||||
fprintf(stderr, "warning: '" STR(cur) "' overriding '" STR(bad) "' in fix spec\n"); \
|
fprintf(stderr, "warning: '" STR(cur) "' overriding '" STR(bad) "' in fix spec\n"); \
|
||||||
|
} \
|
||||||
fixSpec = (fixSpec & ~badFlag) | curFlag; \
|
fixSpec = (fixSpec & ~badFlag) | curFlag; \
|
||||||
break
|
break
|
||||||
#define overrideSpecs(fix, fixFlag, trash, trashFlag) \
|
#define overrideSpecs(fix, fixFlag, trash, trashFlag) \
|
||||||
|
|||||||
@@ -347,13 +347,15 @@ static void writeSymBank(SortedSections const &bankSections, SectionType type, u
|
|||||||
for (auto it = bankSections.zeroLenSections.begin(); \
|
for (auto it = bankSections.zeroLenSections.begin(); \
|
||||||
it != bankSections.zeroLenSections.end(); \
|
it != bankSections.zeroLenSections.end(); \
|
||||||
it++) { \
|
it++) { \
|
||||||
for (Section const *sect = *it; sect; sect = sect->nextu.get()) \
|
for (Section const *sect = *it; sect; sect = sect->nextu.get()) { \
|
||||||
__VA_ARGS__ \
|
__VA_ARGS__ \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
for (auto it = bankSections.sections.begin(); it != bankSections.sections.end(); it++) { \
|
for (auto it = bankSections.sections.begin(); it != bankSections.sections.end(); it++) { \
|
||||||
for (Section const *sect = *it; sect; sect = sect->nextu.get()) \
|
for (Section const *sect = *it; sect; sect = sect->nextu.get()) { \
|
||||||
__VA_ARGS__ \
|
__VA_ARGS__ \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
uint32_t nbSymbols = 0;
|
uint32_t nbSymbols = 0;
|
||||||
|
|||||||
@@ -148,19 +148,21 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
|||||||
#define getToken(ptr, ...) \
|
#define getToken(ptr, ...) \
|
||||||
do { \
|
do { \
|
||||||
token = strtok((ptr), delim); \
|
token = strtok((ptr), delim); \
|
||||||
if (!token) \
|
if (!token) { \
|
||||||
fatal(&where, lineNo, __VA_ARGS__); \
|
fatal(&where, lineNo, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define expectEol(...) \
|
#define expectEol(...) \
|
||||||
do { \
|
do { \
|
||||||
token = strtok(nullptr, delim); \
|
token = strtok(nullptr, delim); \
|
||||||
if (token) \
|
if (token) { \
|
||||||
fatal(&where, lineNo, __VA_ARGS__); \
|
fatal(&where, lineNo, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define expectToken(expected, lineType) \
|
#define expectToken(expected, lineType) \
|
||||||
do { \
|
do { \
|
||||||
getToken(nullptr, "'%c' line is too short", (lineType)); \
|
getToken(nullptr, "'%c' line is too short", (lineType)); \
|
||||||
if (strcasecmp(token, (expected)) != 0) \
|
if (strcasecmp(token, (expected)) != 0) { \
|
||||||
fatal( \
|
fatal( \
|
||||||
&where, \
|
&where, \
|
||||||
lineNo, \
|
lineNo, \
|
||||||
@@ -169,6 +171,7 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
|||||||
(expected), \
|
(expected), \
|
||||||
token \
|
token \
|
||||||
); \
|
); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
uint32_t lineNo = 0;
|
uint32_t lineNo = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user