From: Gabe Black Date: Thu, 11 Oct 2018 02:03:12 +0000 (-0700) Subject: systemc: Warn about using deprecated sc_port constructors. X-Git-Tag: v19.0.0.0~1487 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c9f33bfd4fc5ab67a5e5b4c67a9cca96eb507f0;p=gem5.git systemc: Warn about using deprecated sc_port constructors. This gets rid of one of the last instances of a warning about unimplemented functionality. Change-Id: I3d8e50ea45554cba969118ce873ed3d2b041ec43 Reviewed-on: https://gem5-review.googlesource.com/c/13395 Reviewed-by: Gabe Black Maintainer: Gabe Black --- diff --git a/src/systemc/core/sc_port.cc b/src/systemc/core/sc_port.cc index 69fe6f579..37a534a83 100644 --- a/src/systemc/core/sc_port.cc +++ b/src/systemc/core/sc_port.cc @@ -29,7 +29,7 @@ #include -#include "base/logging.hh" +#include "base/cprintf.hh" #include "systemc/core/module.hh" #include "systemc/core/port.hh" #include "systemc/core/scheduler.hh" @@ -84,9 +84,15 @@ sc_port_base::~sc_port_base() } void -sc_port_base::warn_unimpl(const char *func) const +sc_port_base::warn_port_constructor() const { - warn("%s not implemented.\n", func); + static bool warned = false; + if (!warned) { + SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, + "interface and/or port binding in port constructors " + "is deprecated"); + warned = true; + } } void diff --git a/src/systemc/ext/core/sc_port.hh b/src/systemc/ext/core/sc_port.hh index c4160bafe..2a454f3a0 100644 --- a/src/systemc/ext/core/sc_port.hh +++ b/src/systemc/ext/core/sc_port.hh @@ -79,7 +79,7 @@ class sc_port_base : public sc_object sc_port_base(const char *name, int n, sc_port_policy p); virtual ~sc_port_base(); - void warn_unimpl(const char *func) const; + void warn_port_constructor() const; int maxSize() const; int size() const; @@ -258,40 +258,34 @@ class sc_port : public sc_port_b // Deprecated binding constructors. explicit sc_port(const IF &interface) : sc_port_b(N, P) { - this->warn_unimpl(__PRETTY_FUNCTION__); - // Should warn that these are deprecated. See Accellera sc_port.h. + this->warn_port_constructor(); sc_port_b::bind(const_cast(interface)); } sc_port(const char *name, const IF &interface) : sc_port_b(name, N, P) { - this->warn_unimpl(__PRETTY_FUNCTION__); - // Should warn that these are deprecated. See Accellera sc_port.h. + this->warn_port_constructor(); sc_port_b::bind(const_cast(interface)); } explicit sc_port(sc_port_b &parent) : sc_port_b(N, P) { - this->warn_unimpl(__PRETTY_FUNCTION__); - // Should warn that these are deprecated. See Accellera sc_port.h. + this->warn_port_constructor(); sc_port_b::bind(parent); } sc_port(const char *name, sc_port_b &parent) : sc_port_b(name, N, P) { - this->warn_unimpl(__PRETTY_FUNCTION__); - // Should warn that these are deprecated. See Accellera sc_port.h. + this->warn_port_constructor(); sc_port_b::bind(parent); } explicit sc_port(sc_port &parent) : sc_port_b(N, P) { - this->warn_unimpl(__PRETTY_FUNCTION__); - // Should warn that these are deprecated. See Accellera sc_port.h. + this->warn_port_constructor(); sc_port_b::bind(parent); } sc_port(const char *name, sc_port &parent) : sc_port_b(name, N, P) { - this->warn_unimpl(__PRETTY_FUNCTION__); - // Should warn that these are deprecated. See Accellera sc_port.h. + this->warn_port_constructor(); sc_port_b::bind(parent); }