Made netlist code compile with "-Wextra -Wdouble-promotion

-Wno-unused-parameter". (nw)
This commit is contained in:
couriersud 2015-05-16 22:51:28 +02:00
parent 413b1f9bfb
commit d1b57314bf
12 changed files with 47 additions and 42 deletions

View File

@ -75,7 +75,7 @@ public:
device_slot_option *next() const { return m_next; }
const char *name() const { return m_name; }
const device_type &devtype() const { return m_devtype; }
const bool selectable() const { return m_selectable; }
bool selectable() const { return m_selectable; }
const char *default_bios() const { return m_default_bios; }
machine_config_constructor machine_config() const { return m_machine_config; }
const input_device_default *input_device_defaults() const { return m_input_device_defaults; }
@ -112,7 +112,7 @@ public:
static void static_set_option_machine_config(device_t &device, const char *option, const machine_config_constructor machine_config) { static_option(device, option)->m_machine_config = machine_config; }
static void static_set_option_device_input_defaults(device_t &device, const char *option, const input_device_default *default_input) { static_option(device, option)->m_input_device_defaults = default_input; }
static void static_set_option_clock(device_t &device, const char *option, UINT32 default_clock) { static_option(device, option)->m_clock = default_clock; }
const bool fixed() const { return m_fixed; }
bool fixed() const { return m_fixed; }
const char *default_option() const { return m_default_option; }
device_slot_option *first_option() const { return m_options.first(); }
device_slot_option *option(const char *name) const { if (name) return m_options.find(name); return NULL; }

View File

@ -23,7 +23,7 @@ public:
ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets);
ATTR_COLD virtual void reset() { netlist_matrix_solver_t::reset(); }
ATTR_HOT inline const int N() const { return (m_N == 0 ? m_dim : m_N); }
ATTR_HOT inline int N() const { return (m_N == 0 ? m_dim : m_N); }
ATTR_HOT inline int vsolve_non_dynamic();

View File

@ -122,7 +122,7 @@ public:
ATTR_COLD int get_net_idx(netlist_net_t *net);
ATTR_COLD virtual void log_stats() {};
inline const eSolverType type() const { return m_type; }
inline eSolverType type() const { return m_type; }
protected:
@ -143,7 +143,7 @@ protected:
const netlist_solver_parameters_t &m_params;
ATTR_HOT inline const nl_double current_timestep() { return m_cur_ts; }
ATTR_HOT inline nl_double current_timestep() { return m_cur_ts; }
private:
netlist_time m_last_step;

View File

@ -196,7 +196,7 @@ ATTR_COLD void netlist_base_t::save_register()
netlist_object_t::save_register();
}
ATTR_HOT const nl_double netlist_base_t::gmin() const
ATTR_HOT nl_double netlist_base_t::gmin() const
{
return solver()->gmin();
}
@ -407,7 +407,7 @@ ATTR_COLD void netlist_core_device_t::start_dev()
start();
}
ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
ATTR_HOT ATTR_ALIGN netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
{
if (inp.state() != netlist_input_t::STATE_INP_PASSIVE)
return inp.Q();

View File

@ -368,11 +368,11 @@ public:
PSTATE_INTERFACE_DECL()
ATTR_HOT inline const type_t type() const { return m_objtype; }
ATTR_HOT inline const family_t family() const { return m_family; }
ATTR_HOT inline type_t type() const { return m_objtype; }
ATTR_HOT inline family_t family() const { return m_family; }
ATTR_HOT inline const bool isType(const type_t atype) const { return (m_objtype == atype); }
ATTR_HOT inline const bool isFamily(const family_t afamily) const { return (m_family == afamily); }
ATTR_HOT inline bool isType(const type_t atype) const { return (m_objtype == atype); }
ATTR_HOT inline bool isFamily(const family_t afamily) const { return (m_family == afamily); }
ATTR_HOT inline netlist_base_t & RESTRICT netlist() { return *m_netlist; }
ATTR_HOT inline const netlist_base_t & RESTRICT netlist() const { return *m_netlist; }
@ -446,8 +446,8 @@ public:
ATTR_HOT inline const netlist_net_t & RESTRICT net() const { return *m_net;}
ATTR_HOT inline netlist_net_t & RESTRICT net() { return *m_net;}
ATTR_HOT inline const bool is_state(const state_e astate) const { return (m_state == astate); }
ATTR_HOT inline const state_e state() const { return m_state; }
ATTR_HOT inline bool is_state(const state_e astate) const { return (m_state == astate); }
ATTR_HOT inline state_e state() const { return m_state; }
ATTR_HOT inline void set_state(const state_e astate)
{
nl_assert(astate != STATE_NONEX);
@ -566,8 +566,8 @@ public:
{
}
ATTR_HOT inline const netlist_sig_t Q() const;
ATTR_HOT inline const netlist_sig_t last_Q() const;
ATTR_HOT inline netlist_sig_t Q() const;
ATTR_HOT inline netlist_sig_t last_Q() const;
ATTR_HOT inline void activate_hl();
ATTR_HOT inline void activate_lh();
@ -584,7 +584,7 @@ public:
ATTR_COLD netlist_analog_input_t()
: netlist_input_t(INPUT, ANALOG) { }
ATTR_HOT inline const nl_double Q_Analog() const;
ATTR_HOT inline nl_double Q_Analog() const;
};
//#define INPVAL(_x) (_x).Q()
@ -683,12 +683,12 @@ public:
ATTR_COLD netlist_logic_net_t();
ATTR_COLD virtual ~netlist_logic_net_t() { };
ATTR_HOT inline const netlist_sig_t Q() const
ATTR_HOT inline netlist_sig_t Q() const
{
return m_cur_Q;
}
ATTR_HOT inline const netlist_sig_t new_Q() const
ATTR_HOT inline netlist_sig_t new_Q() const
{
return m_new_Q;
}
@ -744,7 +744,7 @@ public:
ATTR_COLD netlist_analog_net_t();
ATTR_COLD virtual ~netlist_analog_net_t() { };
ATTR_HOT inline const nl_double Q_Analog() const
ATTR_HOT inline nl_double Q_Analog() const
{
//nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
nl_assert(family() == ANALOG);
@ -860,7 +860,7 @@ public:
ATTR_COLD netlist_param_t(const param_type_t atype);
ATTR_HOT inline const param_type_t param_type() const { return m_param_type; }
ATTR_HOT inline param_type_t param_type() const { return m_param_type; }
protected:
@ -878,7 +878,7 @@ public:
ATTR_HOT inline void setTo(const nl_double param);
ATTR_COLD inline void initial(const nl_double val) { m_param = val; }
ATTR_HOT inline const nl_double Value() const { return m_param; }
ATTR_HOT inline nl_double Value() const { return m_param; }
protected:
ATTR_COLD virtual void save_register()
@ -900,7 +900,7 @@ public:
ATTR_HOT inline void setTo(const int param);
ATTR_COLD inline void initial(const int val) { m_param = val; }
ATTR_HOT inline const int Value() const { return m_param; }
ATTR_HOT inline int Value() const { return m_param; }
protected:
ATTR_COLD virtual void save_register()
@ -988,9 +988,9 @@ public:
}
ATTR_COLD void start_dev();
ATTR_HOT const netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp);
ATTR_HOT netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp);
ATTR_HOT inline const netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const
ATTR_HOT inline netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const
{
nl_assert(inp.state() != netlist_input_t::STATE_INP_PASSIVE);
return inp.Q();
@ -1001,9 +1001,9 @@ public:
out.set_Q(val, delay);
}
ATTR_HOT inline const nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
ATTR_HOT inline nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
ATTR_HOT inline const nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
ATTR_HOT inline nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const nl_double val)
{
@ -1127,7 +1127,7 @@ public:
ATTR_HOT inline const netlist_time &time() const { return m_time; }
ATTR_HOT inline NETLIB_NAME(solver) *solver() const { return m_solver; }
ATTR_HOT inline NETLIB_NAME(gnd) *gnd() const { return m_gnd; }
ATTR_HOT const nl_double gmin() const;
ATTR_HOT nl_double gmin() const;
ATTR_HOT void push_to_queue(netlist_net_t &out, const netlist_time &attime);
ATTR_HOT void remove_from_queue(netlist_net_t &out);
@ -1357,13 +1357,13 @@ ATTR_HOT inline void netlist_net_t::reschedule_in_queue(const netlist_time &dela
}
ATTR_HOT inline const netlist_sig_t netlist_logic_input_t::Q() const
ATTR_HOT inline netlist_sig_t netlist_logic_input_t::Q() const
{
nl_assert(family() == LOGIC);
return net().as_logic().Q();
}
ATTR_HOT inline const nl_double netlist_analog_input_t::Q_Analog() const
ATTR_HOT inline nl_double netlist_analog_input_t::Q_Analog() const
{
return net().as_analog().Q_Analog();
}

View File

@ -8,8 +8,10 @@
#ifndef NL_DICE_COMPAT_H_
#define NL_DICE_COMPAT_H_
#ifndef NL_CONVERT_CPP
#include "netlist/devices/net_lib.h"
#include "netlist/analog/nld_twoterm.h"
#endif
/* --------------------------------------------------------------------
* Compatibility macros for DICE netlists ...
* -------------------------------------------------------------------- */
@ -20,6 +22,7 @@
* a temporary support and not be used in commits.
*/
#ifndef NL_CONVERT_CPP
#ifdef NETLIST_DEVELOPMENT
#define CHIP(_n, _t) setup.register_dev( nl_alloc(nld_ ## _t ## _dip), _n);
#else
@ -31,6 +34,10 @@
#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
#define NET_CSTR(_a, _b) setup.register_link( _a, _b);
#else
#define CHIP(_n, _t) TTL_ ## _t ## _DIP(_n)
#endif
#define CIRCUIT_LAYOUT(x) NETLIST_START(x)
#define CIRCUIT_LAYOUT_END NETLIST_END()

View File

@ -49,9 +49,9 @@ public:
clear();
}
ATTR_HOT inline const int capacity() const { return _Size; }
ATTR_HOT inline const bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT inline const bool is_not_empty() const { return (m_end > &m_list[0]); }
ATTR_HOT inline int capacity() const { return _Size; }
ATTR_HOT inline bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT inline bool is_not_empty() const { return (m_end > &m_list[0]); }
ATTR_HOT /*ATTR_ALIGN*/ void push(const entry_t &e)
{

View File

@ -36,7 +36,7 @@ public:
public:
token_id_t() : m_id(-2) {}
token_id_t(const int id) : m_id(id) {}
const int id() const { return m_id; }
int id() const { return m_id; }
private:
int m_id;
};

View File

@ -35,7 +35,7 @@ public:
ATTR_HOT friend inline const netlist_time operator-(const netlist_time &left, const netlist_time &right);
ATTR_HOT friend inline const netlist_time operator+(const netlist_time &left, const netlist_time &right);
ATTR_HOT friend inline const netlist_time operator*(const netlist_time &left, const UINT32 factor);
ATTR_HOT friend inline const UINT32 operator/(const netlist_time &left, const netlist_time &right);
ATTR_HOT friend inline UINT32 operator/(const netlist_time &left, const netlist_time &right);
ATTR_HOT friend inline bool operator>(const netlist_time &left, const netlist_time &right);
ATTR_HOT friend inline bool operator<(const netlist_time &left, const netlist_time &right);
ATTR_HOT friend inline bool operator>=(const netlist_time &left, const netlist_time &right);
@ -50,8 +50,8 @@ public:
ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
ATTR_HOT inline const double as_double() const { return (double) m_time / (double) RESOLUTION; }
ATTR_HOT inline INTERNALTYPE as_raw() const { return m_time; }
ATTR_HOT inline double as_double() const { return (double) m_time / (double) RESOLUTION; }
// for save states ....
ATTR_HOT inline INTERNALTYPE *get_internaltype_ptr() { return &m_time; }
@ -82,7 +82,7 @@ ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UIN
return netlist_time::from_raw(left.m_time * factor);
}
ATTR_HOT inline const UINT32 operator/(const netlist_time &left, const netlist_time &right)
ATTR_HOT inline UINT32 operator/(const netlist_time &left, const netlist_time &right)
{
return left.m_time / right.m_time;
}

View File

@ -63,7 +63,7 @@ inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) thr
return result;
}
inline void operator delete(void *pMem, pblockpool &pool, int extra)
inline void operator delete(void *pMem, pblockpool &pool, ATTR_UNUSED int extra)
{
pool.dealloc(pMem);
}

View File

@ -81,8 +81,6 @@
#define NETLIST_DEVELOPMENT 0
#include "netlist/nl_dice_compat.h"
#include "netlist/devices/net_lib.h"
#include "netlist/analog/nld_twoterm.h"
#define SLOW_BUT_ACCURATE 0

View File

@ -86,7 +86,7 @@ struct options_entry oplist[] =
{ "f", "-", OPTION_STRING, "file to process (default is stdin)" },
{ "listdevices;ld", "", OPTION_BOOLEAN, "list all devices available for use" },
{ "help;h", "0", OPTION_BOOLEAN, "display help" },
{ NULL }
{ NULL, NULL, 0, NULL }
};
NETLIST_START(dummy)