Clement Deschamps

Fixed issues with recent gcc

- Removed exception specification (throw) as it is now deprecated
- Replaced auto_ptr with unique_ptr when using c++11
... ... @@ -32,19 +32,21 @@
* \file gs_datatypes.h Default POD datatypes for GreenBus models
*/
#include <stdint.h>
namespace tlm {
typedef char gs_int8;
typedef short gs_int16;
typedef int gs_int32;
typedef long long gs_int64;
typedef unsigned char gs_uint8;
typedef unsigned short gs_uint16;
typedef unsigned int gs_uint32;
typedef unsigned long long gs_uint64;
typedef long gs_handle;
typedef int8_t gs_int8;
typedef int16_t gs_int16;
typedef int32_t gs_int32;
typedef int64_t gs_int64;
typedef uint8_t gs_uint8;
typedef uint16_t gs_uint16;
typedef uint32_t gs_uint32;
typedef uint64_t gs_uint64;
typedef uintptr_t gs_handle;
} // end namespace tlm
#endif
... ...
... ... @@ -1010,7 +1010,7 @@ public:
* @param parname Name of the observed parameter
* @return Event which is notified at parameter change.
*/
sc_event& getUpdateEvent(const std::string &parname) throw (RegisterObserverFailedException) {
sc_event& getUpdateEvent(const std::string &parname) /* throw (RegisterObserverFailedException) */ {
DEPRECATED_WARNING(name(), "DEPRECATED: getUpdateEvent is deprecated! Use 'my_param.getUpdateEvent()' or use callback 'REGISTER_PARAM_CALLBACK(&my_param, class, method)' instead.");
GCNF_DUMP_N(name(), "getUpdateEvent("<<parname.c_str()<<")");
gs_param_base_T* p = getPar(parname);
... ... @@ -1131,7 +1131,7 @@ public:
*
* @return Event which is notified when new parameter is added.
*/
sc_event& getNewParamEvent() throw (RegisterObserverFailedException) {
sc_event& getNewParamEvent() /* throw (RegisterObserverFailedException) */ {
DEPRECATED_WARNING("GCnf_Api", "DEPRECATED: The getNewParamEvent function is deprecated due to performance reasons! Register a callback instead using mApi.REGISTER_NEW_PARAM_CALLBACK(class_name, callback_function);");
register_as_new_param_observer(); // automatically checks if already done
if (m_new_param_event == NULL) {
... ...
... ... @@ -234,7 +234,7 @@ public:
* @param parname Name of the observed parameter
* @return Event which is notified at parameter change.
*/
virtual sc_event& getUpdateEvent(const std::string &parname) throw (RegisterObserverFailedException) = 0;
virtual sc_event& getUpdateEvent(const std::string &parname) /* throw (RegisterObserverFailedException) */ = 0;
// DEPRECATED Makro for registering callback functions (see method registerCallback). DEPRECATED
#define REGISTER_CALLBACK(class, method, parname) \
... ... @@ -322,7 +322,7 @@ registerNewParamCallback(new gs::cnf::CallbAdapt< class >(this, &class::method))
*
* @return Event which is notified when new parameter is added.
*/
virtual sc_event& getNewParamEvent() throw (RegisterObserverFailedException) = 0;
virtual sc_event& getNewParamEvent() /* throw (RegisterObserverFailedException) */ = 0;
/// Register callback function for notifications of new added (as explicite) or first time implicitely set parameters.
/**
... ...
... ... @@ -483,7 +483,7 @@ namespace cnf {
}
/// @see gs::cnf::GCnf_Api::getUpdateEvent
sc_event& getUpdateEvent(const std::string &parname) throw (RegisterObserverFailedException) {
sc_event& getUpdateEvent(const std::string &parname) /* throw (RegisterObserverFailedException) */ {
if (is_public_param(parname))
return mApi->getUpdateEvent(parname);
DEPRECATED_WARNING(name(), "DEPRECATED: getUpdateEvent is deprecated! Use 'my_param.getUpdateEvent()' or use callback 'REGISTER_PARAM_CALLBACK(&my_param, class, method)' instead.");
... ... @@ -503,7 +503,7 @@ namespace cnf {
}
/// @see gs::cnf::GCnf_Api::getNewParamEvent
sc_event& getNewParamEvent() throw (RegisterObserverFailedException) {
sc_event& getNewParamEvent() /* throw (RegisterObserverFailedException) */ {
/*
* Register this with a NewParamCallback at the parent API
* and create a local new_param_event which will be notified
... ...
... ... @@ -44,7 +44,7 @@ namespace cnf {
// forward declarations
class gs_param_base;
template<typename T> class gs_param;
template<typename T, template<class T> class gs_param_T, typename ConfigPlugin_T> class GCnf_private_Api_T;
template<typename T, template<class T_> class gs_param_T, typename ConfigPlugin_T> class GCnf_private_Api_T;
/// private Config Plugin to be used within a private config API
/**
... ...
... ... @@ -136,7 +136,7 @@ public:
* @param argc The argc of main(...).
* @param argv The argv of main(...).
*/
void parse(const int argc, const char* const* argv) throw(CommandLineException) {
void parse(const int argc, const char* const* argv) /* throw(CommandLineException) */ {
#ifdef USE_GETOPT
parseCommandLineWithGetOpt(argc, argv);
#else
... ... @@ -155,7 +155,7 @@ private:
* @param argc The argc of main(...).
* @param argv The argv of main(...).
*/
void parseCommandLineWithBoost(const int argc, const char* const* argv) throw(CommandLineException) {
void parseCommandLineWithBoost(const int argc, const char* const* argv) /* throw(CommandLineException) */ {
GCNF_DUMP_N("CommandLineConfigParser", "Parse command line ("<<argc<<" arguments) with boost program_options");
po::options_description desc("Allowed options");
... ... @@ -210,7 +210,7 @@ private:
* @param argc The argc of main(...).
* @param argv The argv of main(...).
*/
void parseCommandLineWithGetOpt(const int argc, const char* const* argv) throw(CommandLineException) {
void parseCommandLineWithGetOpt(const int argc, const char* const* argv) /* throw(CommandLineException) */ {
GCNF_DUMP_N("CommandLineConfigParser", "Parse command line ("<<argc<<" arguments) with getopt");
assert(argc < ARGC_COPY_SIZE); // if this fails, enlarge ARGC_COPY_SIZE
... ... @@ -322,7 +322,7 @@ private:
*
* @param argval Value of the option --param or -p.
*/
void parseAndSetParam(const std::string argval) throw(CommandLineException) {
void parseAndSetParam(const std::string argval) /* throw(CommandLineException) */ {
GCNF_DUMP_N("CommandLineConfigParser", "parseAndSetParam("<<argval.c_str()<<")");
std::string parname;
std::string parvalue;
... ...
... ... @@ -168,7 +168,7 @@ public:
* @param argc The argc of main(...).
* @param argv The argv of main(...).
*/
void parseCommandLine(const int argc, const char* const* argv) throw(CommandLineException) {
void parseCommandLine(const int argc, const char* const* argv) /* throw(CommandLineException) */ {
#ifdef USE_GETOPT
parseCommandLineWithGetOpt(argc, argv);
#else
... ... @@ -260,7 +260,7 @@ protected:
* @param argc The argc of main(...).
* @param argv The argv of main(...).
*/
void parseCommandLineWithBoost(const int argc, const char* const* argv) throw(CommandLineException) {
void parseCommandLineWithBoost(const int argc, const char* const* argv) /* throw(CommandLineException) */ {
GCNF_DUMP_N(m_name.c_str(), "Parse command line ("<<argc<<" arguments) with boost program_options");
for (int i = 0; i<argc; i++) {
... ... @@ -315,7 +315,7 @@ protected:
* @param argc The argc of main(...).
* @param argv The argv of main(...).
*/
void parseCommandLineWithGetOpt(const int argc, const char* const* argv) throw(CommandLineException) {
void parseCommandLineWithGetOpt(const int argc, const char* const* argv) /* throw(CommandLineException) */ {
GCNF_DUMP_N(m_name.c_str(), "Parse command line ("<<argc<<" arguments) with getopt");
assert(argc < ARGC_COPY_SIZE); // if this fails, enlarge ARGC_COPY_SIZE
... ...
... ... @@ -294,7 +294,7 @@ public:
if (m_locked) {
GS_PARAM_DUMP("parameter is locked!");
SC_REPORT_ERROR(GCNF_SC_REPORTER(this->getName()), "parameter is locked!");
return;
return *this;
}
#endif
this->delete_array();
... ...
... ... @@ -258,7 +258,6 @@ public:
// unsafe for bool: (according to MSVS)
//GC_SPECIALISATIONS_BINARY_OPERATORS;
GC_SPECIALISATIONS_INCREMENT_OPERATORS;
// not allowed for bool:
// GC_SPECIALISATIONS_DECREMENT_OPERATORS;
... ...
... ... @@ -135,7 +135,7 @@ public:
/**
* @see gs::cnf::GCnf_Api::getUpdateEvent()
*/
const sc_event& getUpdateEvent(const std::string &parname) throw (RegisterObserverFailedException) {
const sc_event& getUpdateEvent(const std::string &parname) /* throw (RegisterObserverFailedException) */ {
GCNF_DUMP_N(name(), "getUpdateEvent("<<parname.c_str()<<")");
return m_gcnf_api->getUpdateEvent(parname);
}
... ...
... ... @@ -54,7 +54,9 @@ using namespace gs::gp;
#include "tlm_utils/peq_with_get.h" // Payload event queue FIFO
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#include <memory>
#endif
#include <iomanip>
#include "nb_example/gs_dump.h" // needed for GS_DUMP macro if not USE_GPSOCKET
... ... @@ -382,7 +384,11 @@ class BidirModuleHier
{
public:
GenericBidirectionalPort<32> bidir_port; // bidirectional port!!
#if defined(__cplusplus) && (__cplusplus >= 201103L)
std::unique_ptr<BidirModule> child;
#else
std::auto_ptr<BidirModule> child;
#endif
// Constructor
BidirModuleHier(sc_core::sc_module_name name_)
... ...
... ... @@ -43,6 +43,10 @@ using namespace gs::gp;
#include <iomanip>
#include "nb_example/gs_dump.h" // needed for GS_DUMP macro if not USE_GPSOCKET
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#include <memory>
#endif
#define DELAY(x) 10*x, sc_core::SC_NS
... ... @@ -253,7 +257,11 @@ class SlaveMemBidirHier
{
public:
GenericBidirectionalPort<32> target_port;
#if defined(__cplusplus) && (__cplusplus >= 201103L)
std::unique_ptr<SlaveMemBidir> child;
#else
std::auto_ptr<SlaveMemBidir> child;
#endif
SlaveMemBidirHier(sc_core::sc_module_name name_, int delay_=3) :
sc_module(name_),
... ...
... ... @@ -61,6 +61,10 @@ using namespace gs::gp;
#include "tlm_utils/peq_with_get.h" // Payload event queue FIFO
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#include <memory>
#endif
#include <iomanip>
... ... @@ -395,7 +399,11 @@ class MasterHier
{
public:
GenericMasterPort<32> init_port;
#if defined(__cplusplus) && (__cplusplus >= 201103L)
std::unique_ptr<Master> child;
#else
std::auto_ptr<Master> child;
#endif
// Constructor
MasterHier(sc_core::sc_module_name name_)
... ...
... ... @@ -54,6 +54,10 @@ using std::list;
using namespace gs;
using namespace gs::gp;
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#include <memory>
#endif
#include <iomanip>
#define DELAY(x) 10*x, sc_core::SC_NS
... ... @@ -304,7 +308,11 @@ class SlaveMemHier
{
public:
GenericSlavePort<32> target_port;
#if defined(__cplusplus) && (__cplusplus >= 201103L)
std::unique_ptr<SlaveMem> child;
#else
std::auto_ptr<SlaveMem> child;
#endif
SlaveMemHier(sc_core::sc_module_name name_, int delay_=3) :
sc_module(name_),
... ...
... ... @@ -232,8 +232,9 @@ public:
// Destructor: delete own data if this has
~GSDataData() {
if (own_array)
if (own_array) {
delete[] own_array; own_array = NULL;
}
}
/// set data pointer (remove own data if this has)
... ...
... ... @@ -147,7 +147,7 @@ namespace gs {
// register callback function to this Socket, see start_of_simulation
// use in-port pointer address as unique master ID (this is important to make genericRouter work)
MasterPortNumber = (gs_handle) this;
MasterPortNumber = reinterpret_cast<gs_handle>(this);
}
/// Destructor
... ...
... ... @@ -26,18 +26,20 @@
* \file gs_datatypes.h Default POD datatypes for GreenBus models
*/
#include <stdint.h>
namespace gs {
typedef char gs_int8;
typedef short gs_int16;
typedef int gs_int32;
typedef long long gs_int64;
typedef int8_t gs_int8;
typedef int16_t gs_int16;
typedef int32_t gs_int32;
typedef int64_t gs_int64;
typedef unsigned char gs_uint8;
typedef unsigned short gs_uint16;
typedef unsigned int gs_uint32;
typedef unsigned long long gs_uint64;
typedef long gs_handle;
typedef uint8_t gs_uint8;
typedef uint16_t gs_uint16;
typedef uint32_t gs_uint32;
typedef uint64_t gs_uint64;
typedef uintptr_t gs_handle;
} // end namespace tlm
... ...