Don't check for macro redefinition if the warning is disabled.
And reword the comment to be a bit less dictatorial.
This commit is contained in:
parent
e408550d9d
commit
af1ea13c47
|
|
@ -860,16 +860,17 @@ void define_macro(const char* name, const char* value, int keyword, int argc)
|
|||
struct define_t* def;
|
||||
struct define_t* prev;
|
||||
|
||||
/* Verilog spec has a very nasty system of macros jumping from
|
||||
* file to file, resulting in a global macro scope. We abosolutely
|
||||
* MUST track macro redefinitions and warn user about them.
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
prev = def_lookup(name);
|
||||
if (prev && warn_redef) {
|
||||
emit_pathline(istack);
|
||||
fprintf(stderr, "warning: redefinition of macro %s from value '%s' to '%s'\n",
|
||||
name, prev->value, value);
|
||||
if (warn_redef) {
|
||||
prev = def_lookup(name);
|
||||
if (prev) {
|
||||
emit_pathline(istack);
|
||||
fprintf(stderr, "warning: redefinition of macro %s from value '%s' to '%s'\n",
|
||||
name, prev->value, value);
|
||||
}
|
||||
}
|
||||
|
||||
def = malloc(sizeof(struct define_t));
|
||||
|
|
|
|||
Loading…
Reference in New Issue