summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-06-27 22:03:01 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-06-27 22:03:01 -0700
commit42b9579f90d26d2123036cbab9ca8c20226423d3 (patch)
tree9a7289664befc903f709e7a0be2660061a3121fd /asm
parent4431b268ae7e36096f5ab20bfab0d448ab49f5a3 (diff)
downloadnasm-note.tar.gz
preproc: add new %note directivenote
Add a new %note directive to issue a note into the list file without printing a message. The difference between %note and a comment is that a %note will be issued with single-line macros expanded, and will be issued even if it occurs inside a .nolist macro. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'asm')
-rw-r--r--asm/nasm.c18
-rw-r--r--asm/pptok.dat3
-rw-r--r--asm/preproc.c7
3 files changed, 23 insertions, 5 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index 55e4a8cf..e1e3eff0 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1802,6 +1802,12 @@ static bool skip_this_pass(int severity)
return false;
/*
+ * We *never* print a message for ERR_NOTE.
+ */
+ if ((severity & ERR_MASK) == ERR_NOTE)
+ return true;
+
+ /*
* passn is 1 on the very first pass only.
* pass0 is 2 on the code-generation (final) pass only.
* These are the passes we care about in this case.
@@ -1826,6 +1832,12 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
const char *pfx;
switch (severity & (ERR_MASK|ERR_NO_SEVERITY)) {
+ case ERR_NOTE:
+ pfx = "note: ";
+ break;
+ case ERR_DEBUG:
+ pfx = "debug: ";
+ break;
case ERR_WARNING:
pfx = "warning: ";
break;
@@ -1838,9 +1850,6 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
case ERR_PANIC:
pfx = "panic: ";
break;
- case ERR_DEBUG:
- pfx = "debug: ";
- break;
default:
pfx = "";
break;
@@ -1861,7 +1870,7 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
/*
* Don't suppress this with skip_this_pass(), or we don't get
- * pass1 or preprocessor warnings in the list file
+ * pass1 or preprocessor warnings or notes in the list file
*/
lfmt->error(severity, pfx, msg);
@@ -1874,6 +1883,7 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
preproc->error_list_macros(severity);
switch (severity & ERR_MASK) {
+ case ERR_NOTE:
case ERR_DEBUG:
/* no further action, by definition */
break;
diff --git a/asm/pptok.dat b/asm/pptok.dat
index a2c64d0a..7bb85280 100644
--- a/asm/pptok.dat
+++ b/asm/pptok.dat
@@ -1,6 +1,6 @@
## --------------------------------------------------------------------------
##
-## Copyright 1996-2016 The NASM Authors - All Rights Reserved
+## Copyright 1996-2018 The NASM Authors - All Rights Reserved
## See the file AUTHORS included with the NASM distribution for
## the specific copyright holders.
##
@@ -76,6 +76,7 @@
%line
%local
%macro
+%note
%pathsearch
%pop
%pragma
diff --git a/asm/preproc.c b/asm/preproc.c
index 8e1e6369..0a6e0fa6 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2735,6 +2735,9 @@ static int do_directive(Token *tline, char **output)
case PP_WARNING:
severity = ERR_WARNING|ERR_WARN_USER;
goto issue_error;
+ case PP_NOTE:
+ severity = ERR_NOTE;
+ goto issue_error;
issue_error:
{
@@ -2759,6 +2762,10 @@ issue_error:
nasm_free(p);
}
free_tlist(origline);
+
+ if (severity == ERR_NOTE)
+ lfmt->drop(); /* Suppress printing the actual %note */
+
return DIRECTIVE_FOUND;
}