aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-04-25 18:00:32 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-04-25 18:00:32 -0700
commit41e9682efed7cd1df133b1b4ac806e07723f1486 (patch)
tree001a3ef33fa108a5aac02318526f401e9c4d0e71 /include
parent61891333636f2bda70f28c7cc5324f808412de58 (diff)
downloadnasm-41e9682efed7cd1df133b1b4ac806e07723f1486.tar.gz
nasm-41e9682efed7cd1df133b1b4ac806e07723f1486.tar.xz
nasm-41e9682efed7cd1df133b1b4ac806e07723f1486.zip
preproc: massive cleanup of smacro expansion
The smacro expansion code was virtually impossible to understand, and was leading to very strange failures. Clean it up, and do much better handling of magic macros. This should also allow for recursive macros, but recursive macros are extremely tricky in that it is very hard to keep them from recursing forever, unless there is at least one argument which is never expanded. They are not currently implemented. Even so, I believe token pasting makes it possible to create infinite loops; e.g.: %define foo foo %+ Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/nasmlib.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/nasmlib.h b/include/nasmlib.h
index c41a5bad..a5994528 100644
--- a/include/nasmlib.h
+++ b/include/nasmlib.h
@@ -42,6 +42,19 @@
#include "bytesex.h"
/*
+ * Useful construct for private values
+ */
+union intorptr {
+ int64_t i;
+ uint64_t u;
+ size_t s;
+ void *p;
+ const void *cp;
+ uintptr_t up;
+};
+typedef union intorptr intorptr;
+
+/*
* Wrappers around malloc, realloc, free and a few more. nasm_malloc
* will fatal-error and die rather than return NULL; nasm_realloc will
* do likewise, and will also guarantee to work right on being passed