31a32
> #include "systemc/core/scheduler.hh"
32a34
> #include "systemc/ext/core/sc_main.hh"
36a39,56
> namespace
> {
>
> void
> reportError(const char *id, const char *add_msg,
> const char *name, const char *kind)
> {
> std::string msg;
> if (add_msg)
> msg = csprintf("%s: export '%s' (%s)", add_msg, name, kind);
> else
> msg = csprintf("export '%s' (%s)", name, kind);
>
> SC_REPORT_ERROR(id, msg.c_str());
> }
>
> }
>
38a59,67
> if (sc_is_running()) {
> reportError("(E121) insert sc_export failed", "simulation running",
> n, kind());
> }
> if (::sc_gem5::scheduler.elaborationDone()) {
> reportError("(E121) insert sc_export failed", "elaboration done",
> n, kind());
> }
>
40c69,74
< m->exports.push_back(this);
---
> if (!m) {
> reportError("(E122) sc_export specified outside of module",
> nullptr, n, kind());
> } else {
> m->exports.push_back(this);
> }