Currently, nvboard.h includes almost all of the other headers, and C++ source files in the project include nvboard.h to access definitions and macros. However, external library users also use this header file, which exposes many symbols that are not needed, such as str() and str_temp(). This can cause problems since the name str() is very common in user code and libraries.
To provide a minimum reproducible example, apply the following patch to the example:
This will not compile because our macro str() will cause a compile error in the following line in verilator_cov.h:
return os.str();
PS: This issue can be circumvented by including Vtop.h first in auto_bind.cpp.
We can address this by limiting the functions and macros exposed in nvboard.h. Additionally, it's generally better practice to include only the necessary headers in header files, as disscussed here.
I've tested this patch, but we probably need more tests as it might introduce bugs due to missing references.
Currently,
nvboard.h
includes almost all of the other headers, and C++ source files in the project includenvboard.h
to access definitions and macros. However, external library users also use this header file, which exposes many symbols that are not needed, such asstr()
andstr_temp()
. This can cause problems since the namestr()
is very common in user code and libraries.To provide a minimum reproducible example, apply the following patch to the example:
This will not compile because our macro
str()
will cause a compile error in the following line in verilator_cov.h:PS: This issue can be circumvented by including
Vtop.h
first inauto_bind.cpp
.We can address this by limiting the functions and macros exposed in
nvboard.h
. Additionally, it's generally better practice to include only the necessary headers in header files, as disscussed here.I've tested this patch, but we probably need more tests as it might introduce bugs due to missing references.