diff options
author | H. Peter Anvin <hpa@zytor.com> | 2019-08-10 06:45:12 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2019-08-10 06:45:12 -0700 |
commit | 59d4ccc2b06a25e30a4ba0a62ad64905d88e562b (patch) | |
tree | 2ddfe78a83a02388197ac9d1db1032d51a8da715 /asm/listing.h | |
parent | 06335873ae360054ae08c67762cbe3d8ee9ca489 (diff) | |
download | nasm-59d4ccc2b06a25e30a4ba0a62ad64905d88e562b.tar.gz |
Add %pragma list options
Add a %pragma to set (or clear) listing options. It only takes effect
on the next assembly pass, however!
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'asm/listing.h')
-rw-r--r-- | asm/listing.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/asm/listing.h b/asm/listing.h index 9d4a3353..88931556 100644 --- a/asm/listing.h +++ b/asm/listing.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- * - * + * * Copyright 1996-2019 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. @@ -14,7 +14,7 @@ * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -31,13 +31,15 @@ * * ----------------------------------------------------------------------- */ -/* +/* * listing.h header file for listing.c */ #ifndef NASM_LISTING_H #define NASM_LISTING_H +#include "nasm.h" + /* * List-file generators should look like this: */ @@ -113,7 +115,15 @@ struct lfmt { extern const struct lfmt *lfmt; extern bool user_nolist; -extern uint64_t active_list_options; /* Simply a bitmask of ASCII-64 */ + +/* + * list_options are the requested options; active_list_options gets + * set when a pass starts. + * + * These are simple bitmasks of ASCII-64 mapping directly to option + * letters. + */ +extern uint64_t list_options, active_list_options; static inline bool list_option(char x) { @@ -123,4 +133,14 @@ static inline bool list_option(char x) return unlikely(active_list_options & (UINT64_C(1) << p)); } +/* We can't test this using active_list_options for obvious reasons... */ +static inline bool list_on_every_pass(void) +{ + const unsigned int p = 'p' - '@'; + return unlikely(list_options & (UINT64_C(1) << p)); +} + +/* Pragma handler */ +enum directive_result list_pragma(const struct pragma *); + #endif |