summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-07-13 11:43:06 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-07-13 11:46:37 -0700
commit5b00bf4d4923756ac6da6e5f9282dacb2877047f (patch)
treecf8720b4777b7ad324a96d60e0be6ca6e8b5d8d6
parent702df6d6cc256ce36a63ea1de02d7044a69fef67 (diff)
downloadnasm-5b00bf4d4923756ac6da6e5f9282dacb2877047f.tar.gz
BR3028880: Revert to nonfatal, better error message, cleanup
Revert to issuing a nonfatal error (it makes no sense to make it a fatal error, but it probably makes sense for it to be an error instead of a warning, especially since a lot of prior versions would crash and apparently noone noticed.) We might have to revisit this based on user requirements, and/or provide a method for the user to detect an existing environment variable (%ifenv?). Issue a better error message, indicating the nature of the failure. Simplify the code by just updating the string in "p". Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--preproc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/preproc.c b/preproc.c
index 570f9d11..cc5034f3 100644
--- a/preproc.c
+++ b/preproc.c
@@ -1182,10 +1182,12 @@ static char *detoken(Token * tlist, bool expand_locals)
if (t->type == TOK_PREPROC_ID && t->text[1] == '!') {
char *p = getenv(t->text + 2);
char *q = t->text;
- if (p)
- t->text = nasm_strdup(p);
- else
- error(ERR_FATAL, "`%s' is empty", q + 2);
+ if (!p) {
+ error(ERR_NONFATAL | ERR_PASS1,
+ "nonexistent environment variable `%s'", q + 2);
+ p = "";
+ }
+ t->text = nasm_strdup(p);
nasm_free(q);
}
/* Expand local macros here and not during preprocessing */