Removed a number of "uninitialized member" warnings by using a template wrapper around those members.

This commit is contained in:
Couriersud 2014-06-19 15:21:32 +00:00
parent a98376d18b
commit 436d23064e
16 changed files with 48 additions and 26 deletions

View File

@ -30,10 +30,10 @@ NETLIB_RESET(4066)
NETLIB_UPDATE(4066) NETLIB_UPDATE(4066)
{ {
double sup = (m_supply->vdd() - m_supply->vss()); double sup = (m_supply.get()->vdd() - m_supply.get()->vss());
double low = 0.45 * sup; double low = 0.45 * sup;
double high = 0.55 * sup; double high = 0.55 * sup;
double in = INPANALOG(m_control) - m_supply->vss(); double in = INPANALOG(m_control) - m_supply.get()->vss();
double rON = 270.0 * 5.0 / sup; double rON = 270.0 * 5.0 / sup;
if (in < low) if (in < low)

View File

@ -45,7 +45,7 @@ public:
netlist_analog_input_t m_control; netlist_analog_input_t m_control;
NETLIB_NAME(R) m_R; NETLIB_NAME(R) m_R;
NETLIB_NAME(vdd_vss) *m_supply; netlist_state_t<NETLIB_NAME(vdd_vss) *>m_supply;
); );
NETLIB_DEVICE(4066_dip, NETLIB_DEVICE(4066_dip,

View File

@ -80,9 +80,9 @@ NETLIB_SUBDEVICE(74107Asub,
netlist_ttl_output_t m_Q; netlist_ttl_output_t m_Q;
netlist_ttl_output_t m_QQ; netlist_ttl_output_t m_QQ;
netlist_sig_t m_Q1; netlist_state_t<netlist_sig_t> m_Q1;
netlist_sig_t m_Q2; netlist_state_t<netlist_sig_t> m_Q2;
netlist_sig_t m_F; netlist_state_t<netlist_sig_t> m_F;
ATTR_HOT void newstate(const netlist_sig_t state); ATTR_HOT void newstate(const netlist_sig_t state);

View File

@ -43,9 +43,9 @@ public:
netlist_analog_input_t m_CV; netlist_analog_input_t m_CV;
netlist_sig_t m_last_trig; netlist_state_t<netlist_sig_t> m_last_trig;
UINT8 m_state; netlist_state_t<UINT8> m_state;
double m_KP; netlist_state_t<double> m_KP;
netlist_param_double_t m_K; netlist_param_double_t m_K;
netlist_param_double_t m_RI; netlist_param_double_t m_RI;

View File

@ -66,7 +66,7 @@ NETLIB_SUBDEVICE(74153sub,
netlist_ttl_output_t m_Y; netlist_ttl_output_t m_Y;
int m_chan; netlist_state_t<int> m_chan;
); );
NETLIB_DEVICE(74153, NETLIB_DEVICE(74153,

View File

@ -49,7 +49,7 @@ NETLIB_SUBDEVICE(7448_sub,
netlist_ttl_input_t m_D; netlist_ttl_input_t m_D;
netlist_ttl_input_t m_RBIQ; netlist_ttl_input_t m_RBIQ;
UINT8 m_state; netlist_state_t<UINT8> m_state;
netlist_ttl_output_t m_a; netlist_ttl_output_t m_a;
netlist_ttl_output_t m_b; netlist_ttl_output_t m_b;

View File

@ -57,7 +57,7 @@
NETLIB_SUBDEVICE(7474sub, NETLIB_SUBDEVICE(7474sub,
netlist_ttl_input_t m_CLK; netlist_ttl_input_t m_CLK;
UINT8 m_nextD; netlist_state_t<UINT8> m_nextD;
netlist_ttl_output_t m_Q; netlist_ttl_output_t m_Q;
netlist_ttl_output_t m_QQ; netlist_ttl_output_t m_QQ;

View File

@ -55,7 +55,7 @@ NETLIB_DEVICE(7483,
netlist_ttl_input_t m_B3; netlist_ttl_input_t m_B3;
netlist_ttl_input_t m_B4; netlist_ttl_input_t m_B4;
UINT8 m_lastr; netlist_state_t<UINT8> m_lastr;
netlist_ttl_output_t m_S1; netlist_ttl_output_t m_S1;
netlist_ttl_output_t m_S2; netlist_ttl_output_t m_S2;

View File

@ -80,7 +80,7 @@ NETLIB_DEVICE(7490,
netlist_ttl_input_t m_A; netlist_ttl_input_t m_A;
netlist_ttl_input_t m_B; netlist_ttl_input_t m_B;
UINT8 m_cnt; netlist_state_t<UINT8> m_cnt;
netlist_ttl_output_t m_Q[4]; netlist_ttl_output_t m_Q[4];
); );

View File

@ -73,7 +73,7 @@ NETLIB_SUBDEVICE(7493ff,
netlist_ttl_input_t m_I; netlist_ttl_input_t m_I;
netlist_ttl_output_t m_Q; netlist_ttl_output_t m_Q;
UINT8 m_reset; netlist_state_t<UINT8> m_reset;
); );
NETLIB_DEVICE(7493, NETLIB_DEVICE(7493,

View File

@ -40,7 +40,7 @@ NETLIB_SUBDEVICE(SN74LS629clk,
netlist_logic_output_t m_Y; netlist_logic_output_t m_Y;
netlist_time m_inc; netlist_time m_inc;
netlist_sig_t m_enableq; netlist_state_t<netlist_sig_t> m_enableq;
); );
NETLIB_DEVICE_WITH_PARAMS(SN74LS629, NETLIB_DEVICE_WITH_PARAMS(SN74LS629,

View File

@ -73,9 +73,9 @@ NETLIB_START(9316_sub)
register_output("QD", m_QD); register_output("QD", m_QD);
register_output("RC", m_RC); register_output("RC", m_RC);
save(NAME(m_cnt)); save(NAME(m_cnt.ref()));
save(NAME(m_loadq)); save(NAME(m_loadq.ref()));
save(NAME(m_ent)); save(NAME(m_ent.ref()));
} }
NETLIB_RESET(9316_sub) NETLIB_RESET(9316_sub)
@ -103,7 +103,7 @@ NETLIB_UPDATE(9316_sub)
} }
else else
{ {
cnt = m_ABCD->read_ABCD(); cnt = m_ABCD.get()->read_ABCD();
update_outputs_all(cnt); update_outputs_all(cnt);
OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20)); OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
} }

View File

@ -81,10 +81,10 @@ NETLIB_SUBDEVICE(9316_sub,
netlist_ttl_input_t m_CLK; netlist_ttl_input_t m_CLK;
UINT8 m_cnt; netlist_state_t<UINT8> m_cnt;
NETLIB_NAME(9316_subABCD) *m_ABCD; netlist_state_t<NETLIB_NAME(9316_subABCD) *> m_ABCD;
netlist_sig_t m_loadq; netlist_state_t<netlist_sig_t> m_loadq;
netlist_sig_t m_ent; netlist_state_t<netlist_sig_t> m_ent;
netlist_ttl_output_t m_QA; netlist_ttl_output_t m_QA;
netlist_ttl_output_t m_QB; netlist_ttl_output_t m_QB;

View File

@ -28,7 +28,7 @@ NETLIB_DEVICE(log,
~NETLIB_NAME(log)(); ~NETLIB_NAME(log)();
netlist_analog_input_t m_I; netlist_analog_input_t m_I;
protected: protected:
FILE *m_file; netlist_state_t<FILE *> m_file;
); );
#define LOGD(_name, _I, _I2) \ #define LOGD(_name, _I, _I2) \

View File

@ -37,7 +37,7 @@ NETLIB_DEVICE(NE555,
netlist_analog_input_t m_TRIG; netlist_analog_input_t m_TRIG;
netlist_analog_output_t m_OUT; netlist_analog_output_t m_OUT;
bool m_last_out; netlist_state_t<bool> m_last_out;
inline double clamp(const double v, const double a, const double b); inline double clamp(const double v, const double a, const double b);

View File

@ -276,6 +276,24 @@ struct netlist_logic_family_desc_t
extern netlist_logic_family_desc_t netlist_family_ttl; extern netlist_logic_family_desc_t netlist_family_ttl;
// ----------------------------------------------------------------------------------------
// netlist_state_t
// ----------------------------------------------------------------------------------------
template< typename X>
class netlist_state_t {
public:
inline netlist_state_t() : m_x(static_cast<X>(0)) {}
inline netlist_state_t(const X& x_) : m_x(x_) {}
inline const X& get() const { return m_x; }
inline X& ref() { return m_x; }
inline operator const X&() const { return m_x; }
inline operator X&() { return m_x; }
private:
X m_x;
};
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// netlist_object_t // netlist_object_t
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
@ -321,6 +339,10 @@ public:
ATTR_COLD const pstring &name() const; ATTR_COLD const pstring &name() const;
PSTATE_INTERFACE_DECL() PSTATE_INTERFACE_DECL()
template<typename C> ATTR_COLD void save(netlist_state_t<C> &state, const pstring &stname)
{
save(state.ref(), stname);
}
ATTR_HOT inline const type_t type() const { return m_objtype; } 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 const family_t family() const { return m_family; }