mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Add check for valid macro names in macro definitions
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
c4bd318e76
commit
65f197e28f
|
@ -490,13 +490,17 @@ std::string frontend_verilog_preproc(std::istream &f, std::string filename, cons
|
||||||
}
|
}
|
||||||
while (newline_count-- > 0)
|
while (newline_count-- > 0)
|
||||||
return_char('\n');
|
return_char('\n');
|
||||||
// printf("define: >>%s<< -> >>%s<<\n", name.c_str(), value.c_str());
|
if (strchr("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ$0123456789", name[0])) {
|
||||||
defines_map[name] = value;
|
// printf("define: >>%s<< -> >>%s<<\n", name.c_str(), value.c_str());
|
||||||
if (state == 2)
|
defines_map[name] = value;
|
||||||
defines_with_args.insert(name);
|
if (state == 2)
|
||||||
else
|
defines_with_args.insert(name);
|
||||||
defines_with_args.erase(name);
|
else
|
||||||
global_defines_cache[name] = std::pair<std::string, bool>(value, state == 2);
|
defines_with_args.erase(name);
|
||||||
|
global_defines_cache[name] = std::pair<std::string, bool>(value, state == 2);
|
||||||
|
} else {
|
||||||
|
log_file_error(filename, 0, "Invalid name for macro definition: >>%s<<.\n", name.c_str());
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue