From c0845d8bea17eb101f63301b95bae9f4cb178e93 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Wed, 8 Nov 2017 20:07:38 +0000 Subject: [PATCH] Fix assertion failure when using -Wmacro-redefinition, -y, and -D. Predefined macros get stored in the precompiled macro file that gets read back in when processing library files. This means the predefined macros get processed twice. We need to skip the check in this case. --- ivlpp/lexor.lex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 5ab3e55de..626c7071c 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -863,8 +863,13 @@ void define_macro(const char* name, const char* value, int keyword, int argc) /* Verilog has a very nasty system of macros jumping from * file to file, resulting in a global macro scope. Here * we optionally warn about any redefinitions. + * + * If istack is empty, we are processing a configuration + * or precompiled macro file, so don't want to check for + * redefinitions - when a precompiled macro file is used, + * it will contain copies of any predefined macros. */ - if (warn_redef) { + if (warn_redef && istack) { prev = def_lookup(name); if (prev && (warn_redef_all || (strcmp(prev->value, value) != 0))) { emit_pathline(istack);