aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-06-10 17:10:15 +0000
committerGitHub <noreply@github.com>2020-06-10 17:10:15 +0000
commit8a4841d78690313a91af97e8c6d9aa3e65a3e491 (patch)
treec4240687b4837dcd001927bec2e057d8158345a2
parent072b14f1a945d096d6f72fc4ac621354aa636c70 (diff)
parent6021ff727d331b04438a02675b8d9e82e6f9f1c8 (diff)
downloadyosys-8a4841d78690313a91af97e8c6d9aa3e65a3e491.tar.gz
yosys-8a4841d78690313a91af97e8c6d9aa3e65a3e491.tar.bz2
yosys-8a4841d78690313a91af97e8c6d9aa3e65a3e491.zip
Merge pull request #2141 from whitequark/cxxrtl-cxx11
cxxrtl: various compiler compatibility fixes
-rw-r--r--backends/cxxrtl/cxxrtl.h11
-rw-r--r--backends/cxxrtl/cxxrtl_backend.cc3
-rw-r--r--backends/cxxrtl/cxxrtl_vcd_capi.h4
3 files changed, 10 insertions, 8 deletions
diff --git a/backends/cxxrtl/cxxrtl.h b/backends/cxxrtl/cxxrtl.h
index bc3162981..ce21cc1e6 100644
--- a/backends/cxxrtl/cxxrtl.h
+++ b/backends/cxxrtl/cxxrtl.h
@@ -608,6 +608,7 @@ struct memory {
// This utterly reprehensible construct is the most reasonable way to apply a function to every element
// of a parameter pack, if the elements all have different types and so cannot be cast to an initializer list.
auto _ = {std::move(std::begin(init.data), std::end(init.data), data.begin() + init.offset)...};
+ (void)_;
}
// An operator for direct memory reads. May be used at any time during the simulation.
@@ -676,10 +677,8 @@ struct metadata {
// In debug mode, using the wrong .as_*() function will assert.
// In release mode, using the wrong .as_*() function will safely return a default value.
- union {
- const unsigned uint_value = 0;
- const signed sint_value;
- };
+ const unsigned uint_value = 0;
+ const signed sint_value = 0;
const std::string string_value = "";
const double double_value = 0.0;
@@ -826,7 +825,9 @@ struct module {
return deltas;
}
- virtual void debug_info(debug_items &items, std::string path = "") {}
+ virtual void debug_info(debug_items &items, std::string path = "") {
+ (void)items, (void)path;
+ }
};
} // namespace cxxrtl
diff --git a/backends/cxxrtl/cxxrtl_backend.cc b/backends/cxxrtl/cxxrtl_backend.cc
index be73c9079..052053c52 100644
--- a/backends/cxxrtl/cxxrtl_backend.cc
+++ b/backends/cxxrtl/cxxrtl_backend.cc
@@ -1922,8 +1922,9 @@ struct CxxrtlWorker {
if (top_module != nullptr && debug_info) {
f << "cxxrtl_toplevel " << design_ns << "_create() {\n";
inc_indent();
+ std::string top_type = design_ns + "::" + mangle(top_module);
f << indent << "return new _cxxrtl_toplevel { ";
- f << "std::make_unique<" << design_ns << "::" << mangle(top_module) << ">()";
+ f << "std::unique_ptr<" << top_type << ">(new " + top_type + ")";
f << " };\n";
dec_indent();
f << "}\n";
diff --git a/backends/cxxrtl/cxxrtl_vcd_capi.h b/backends/cxxrtl/cxxrtl_vcd_capi.h
index 6a7fb9f47..d55afe223 100644
--- a/backends/cxxrtl/cxxrtl_vcd_capi.h
+++ b/backends/cxxrtl/cxxrtl_vcd_capi.h
@@ -75,8 +75,8 @@ void cxxrtl_vcd_add_from(cxxrtl_vcd vcd, cxxrtl_handle handle);
//
// Objects can only be scheduled before the first call to `cxxrtl_vcd_sample`.
void cxxrtl_vcd_add_from_if(cxxrtl_vcd vcd, cxxrtl_handle handle, void *data,
- int (*filter)(void *data, const char *name,
- const struct cxxrtl_object *object));
+ int (*filter)(void *data, const char *name,
+ const struct cxxrtl_object *object));
// Schedule all CXXRTL objects in a simulation except for memories.
//