mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #2092 from whitequark/rtlil-no-space-control
Restrict RTLIL::IdString to not contain whitespace or control chars
This commit is contained in:
commit
af36afe722
|
@ -150,9 +150,6 @@ namespace RTLIL
|
||||||
if (!p[0])
|
if (!p[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_assert(p[0] == '$' || p[0] == '\\');
|
|
||||||
log_assert(p[1] != 0);
|
|
||||||
|
|
||||||
auto it = global_id_index_.find((char*)p);
|
auto it = global_id_index_.find((char*)p);
|
||||||
if (it != global_id_index_.end()) {
|
if (it != global_id_index_.end()) {
|
||||||
#ifndef YOSYS_NO_IDS_REFCNT
|
#ifndef YOSYS_NO_IDS_REFCNT
|
||||||
|
@ -165,6 +162,11 @@ namespace RTLIL
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_assert(p[0] == '$' || p[0] == '\\');
|
||||||
|
log_assert(p[1] != 0);
|
||||||
|
for (const char *c = p; *c; c++)
|
||||||
|
log_assert((unsigned)*c > (unsigned)' ');
|
||||||
|
|
||||||
#ifndef YOSYS_NO_IDS_REFCNT
|
#ifndef YOSYS_NO_IDS_REFCNT
|
||||||
if (global_free_idx_list_.empty()) {
|
if (global_free_idx_list_.empty()) {
|
||||||
if (global_id_storage_.empty()) {
|
if (global_id_storage_.empty()) {
|
||||||
|
|
|
@ -184,9 +184,12 @@ may hold important information for Yosys developers can be used without
|
||||||
disturbing external tools. For example the Verilog backend assigns names in the form {\tt \_{\it integer}\_}.
|
disturbing external tools. For example the Verilog backend assigns names in the form {\tt \_{\it integer}\_}.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
In order to avoid programming errors, the RTLIL data structures check if all
|
Whitespace and control characters (any character with an ASCII code 32 or less) are not allowed
|
||||||
identifiers start with either a backslash or a dollar sign and generate a
|
in RTLIL identifiers; most frontends and backends cannot support these characters in identifiers.
|
||||||
runtime error if this rule is violated.
|
|
||||||
|
In order to avoid programming errors, the RTLIL data structures check if all identifiers start
|
||||||
|
with either a backslash or a dollar sign, and contain no whitespace or control characters.
|
||||||
|
Violating these rules results in a runtime error.
|
||||||
|
|
||||||
All RTLIL identifiers are case sensitive.
|
All RTLIL identifiers are case sensitive.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue