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,17 +860,18 @@ void define_macro(const char* name, const char* value, int keyword, int argc)
|
||||||
struct define_t* def;
|
struct define_t* def;
|
||||||
struct define_t* prev;
|
struct define_t* prev;
|
||||||
|
|
||||||
/* Verilog spec has a very nasty system of macros jumping from
|
/* Verilog has a very nasty system of macros jumping from
|
||||||
* file to file, resulting in a global macro scope. We abosolutely
|
* file to file, resulting in a global macro scope. Here
|
||||||
* MUST track macro redefinitions and warn user about them.
|
* we optionally warn about any redefinitions.
|
||||||
*/
|
*/
|
||||||
|
if (warn_redef) {
|
||||||
prev = def_lookup(name);
|
prev = def_lookup(name);
|
||||||
if (prev && warn_redef) {
|
if (prev) {
|
||||||
emit_pathline(istack);
|
emit_pathline(istack);
|
||||||
fprintf(stderr, "warning: redefinition of macro %s from value '%s' to '%s'\n",
|
fprintf(stderr, "warning: redefinition of macro %s from value '%s' to '%s'\n",
|
||||||
name, prev->value, value);
|
name, prev->value, value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def = malloc(sizeof(struct define_t));
|
def = malloc(sizeof(struct define_t));
|
||||||
def->name = strdup(name);
|
def->name = strdup(name);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue