From b1909cf39b8028b72cf527ba617a940e329ea05c Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Wed, 4 Mar 2026 14:14:02 -0800 Subject: [PATCH] listing: move LIST_* enums to listing.h The LIST_* enums belongs in listing.h, move them there and actually use them in listing.c. Signed-off-by: H. Peter Anvin (Intel) --- asm/listing.c | 6 +++--- asm/listing.h | 18 +++++++++++++++--- include/nasm.h | 12 ------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/asm/listing.c b/asm/listing.c index 76252e68d..c0a64c56e 100644 --- a/asm/listing.c +++ b/asm/listing.c @@ -260,7 +260,7 @@ static void list_output(const struct out_data *data) } } -static void list_line(int type, int32_t lineno, const char *line) +static void list_line(enum list_type type, int32_t lineno, const char *line) { (void)type; @@ -279,7 +279,7 @@ static void list_line(int type, int32_t lineno, const char *line) listlevel_e = listlevel; } -static void list_uplevel(int type, int64_t size) +static void list_uplevel(enum list_type type, int64_t size) { if (!listfp) return; @@ -305,7 +305,7 @@ static void list_uplevel(int type, int64_t size) } } -static void list_downlevel(int type) +static void list_downlevel(enum list_type type) { if (!listfp) return; diff --git a/asm/listing.h b/asm/listing.h index 6421dbc4c..40fe14acd 100644 --- a/asm/listing.h +++ b/asm/listing.h @@ -13,6 +13,18 @@ /* List options implied by -L+ */ #define LIST_PLUS_OPTIONS "bdefFmps" +/* Listing type values flags */ +enum list_type { + /* Flags for lfmt->line() */ + LIST_READ, + LIST_MACRO, + LIST_INFO, + /* Flags for lfmt->uplevel() */ + LIST_INCLUDE, + LIST_INCBIN, + LIST_TIMES +}; + /* * List-file generators should look like this: */ @@ -49,7 +61,7 @@ struct lfmt { * If a line number is provided, print it; if the line number is * -1 then use the same line number as the previous call. */ - void (*line)(int type, int32_t lineno, const char *line); + void (*line)(enum list_type type, int32_t lineno, const char *line); /* * Called to change one of the various levelled mechanisms in the @@ -65,12 +77,12 @@ struct lfmt { * macro, so anything under that level won't be expanded unless * it includes another file. */ - void (*uplevel)(int type, int64_t size); + void (*uplevel)(enum list_type type, int64_t size); /* * Reverse the effects of uplevel. */ - void (*downlevel)(int type); + void (*downlevel)(enum list_type type); /* * Called on a warning or error, with the error message. diff --git a/include/nasm.h b/include/nasm.h index ec8ec7729..652ff0671 100644 --- a/include/nasm.h +++ b/include/nasm.h @@ -520,18 +520,6 @@ static inline char *nasm_skip_identifier(const char *str) return (char *)p; } -/* - * Data-type flags that get passed to listing-file routines. - */ -enum { - LIST_READ, - LIST_MACRO, - LIST_INFO, - LIST_INCLUDE, - LIST_INCBIN, - LIST_TIMES -}; - /* * ----------------------------------------------------------- * Format of the `insn' structure returned from `parser.c' and