ref: 43ba7d0efb434f9276f113e5a11f0fb697973bcc
parent: 685ea5feedcd79c070883f3662f521cbfbeddc5d
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Jun 12 12:49:06 EDT 2022
Explain to static analyzer that initial symbol creation cannot fail
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -743,8 +743,13 @@
sym_AddVar("_RS", 0)->isBuiltin = true;
-#define addNumber(name, val) sym_AddEqu(name, val)->isBuiltin = true
-#define addString(name, val) sym_AddString(name, val)->isBuiltin = true
+#define addSym(fn, name, val) do { \
+ struct Symbol *sym = fn(name, val); \
+ assert(sym); \
+ sym->isBuiltin = true; \
+} while (0)
+#define addNumber(name, val) addSym(sym_AddEqu, name, val)
+#define addString(name, val) addSym(sym_AddString, name, val)
addString("__RGBDS_VERSION__", get_package_version_string());
addNumber("__RGBDS_MAJOR__", PACKAGE_VERSION_MAJOR);
@@ -788,6 +793,7 @@
#undef addNumber
#undef addString
+#undef addSym
sym_SetCurrentSymbolScope(NULL);
anonLabelID = 0;}