summaryrefslogtreecommitdiff
path: root/asm/listing.h
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-09 08:06:39 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-09 08:39:02 -0700
commitd6e817751e1a809a4e635bbe7ece7e059cbe5f63 (patch)
tree41b276a7c44d9350ec1fa4d2eb2daada09970541 /asm/listing.h
parentd66927a677f75d3c3f5e835054f19f80b4b27179 (diff)
downloadnasm-d6e817751e1a809a4e635bbe7ece7e059cbe5f63.tar.gz
listing: add -L option for additional listing info
Add an -L option for additional listing information. Currently supported is -Le, which emits each line after processing through the preprocessor, and -Lm, which displays each single-line macro defined or undefined. NASM doesn't preserve the names of unused arguments, nor does it have any technical reason to do so. Instead of adding complexity to save them, make unnamed parameters official by specifying an empty string in the argument list. This has the additional advantage that () is now simply considered a single empty argument, which means that NASM should now properly handle things like: %define myreg() eax mov edx,myreg() ... similar to how the C preprocessor allows an empty macro argument list which is distinct from a macro with no arguments whatsoever. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'asm/listing.h')
-rw-r--r--asm/listing.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/asm/listing.h b/asm/listing.h
index dac18bfe..00326854 100644
--- a/asm/listing.h
+++ b/asm/listing.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2019 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -110,5 +110,14 @@ struct lfmt {
extern const struct lfmt *lfmt;
extern bool user_nolist;
+extern uint64_t active_list_options; /* Simply a bitmask of ASCII-64 */
+
+static inline bool list_option(char x)
+{
+ unsigned int p = x - '@';
+ if (p > 63)
+ return false;
+ return unlikely(active_list_options & (UINT64_C(1) << p));
+}
#endif