From 69b145e216bebe4c5fb029a1ffd6db1ed41610b5 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 6 Aug 2014 15:01:28 +0200 Subject: [PATCH] Minor cleaning for valgrind output. --- vhdlpp/expression_elaborate.cc | 8 +++--- vhdlpp/library.cc | 48 +++++++++++++++++----------------- vhdlpp/vtype.h | 12 ++++----- vhdlpp/vtype_stream.cc | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/vhdlpp/expression_elaborate.cc b/vhdlpp/expression_elaborate.cc index 0cff0344c..a53b7d23c 100644 --- a/vhdlpp/expression_elaborate.cc +++ b/vhdlpp/expression_elaborate.cc @@ -519,7 +519,7 @@ const VType* ExpAttribute::probe_type(Entity*ent, Architecture*arc) const base_->probe_type(ent, arc); if (name_ == "length") { - return primitive_INTEGER; + return &primitive_INTEGER; } return 0; @@ -676,7 +676,7 @@ int ExpFunc::elaborate_expr(Entity*ent, Architecture*arc, const VType*) const VType* ExpInteger::probe_type(Entity*, Architecture*) const { - return primitive_INTEGER; + return &primitive_INTEGER; } int ExpInteger::elaborate_expr(Entity*ent, Architecture*arc, const VType*ltype) @@ -694,7 +694,7 @@ int ExpInteger::elaborate_expr(Entity*ent, Architecture*arc, const VType*ltype) const VType* ExpReal::probe_type(Entity*, Architecture*) const { - return primitive_REAL; + return &primitive_REAL; } int ExpReal::elaborate_expr(Entity*ent, Architecture*arc, const VType*ltype) @@ -830,7 +830,7 @@ const VType* ExpRelation::probe_type(Entity*ent, Architecture*arc) const /* const VType*type1 = */ peek_operand1()->probe_type(ent, arc); /* const VType*type2 = */ peek_operand2()->probe_type(ent, arc); - return primitive_BOOLEAN; + return &primitive_BOOLEAN; } int ExpRelation::elaborate_expr(Entity*ent, Architecture*arc, const VType*ltype) diff --git a/vhdlpp/library.cc b/vhdlpp/library.cc index d5a80a106..7266fcba1 100644 --- a/vhdlpp/library.cc +++ b/vhdlpp/library.cc @@ -280,7 +280,7 @@ static void import_ieee_use_std_logic_1164(ActiveScope*res, perm_string name) if (all_flag || name == "std_logic_vector") { vector dims (1); res->use_name(perm_string::literal("std_logic_vector"), - new VTypeArray(primitive_STDLOGIC, dims, false)); + new VTypeArray(&primitive_STDLOGIC, dims, false)); } } @@ -295,12 +295,12 @@ static void import_ieee_use_numeric_bit(ActiveScope*res, perm_string name) if (all_flag || name == "signed") { vector dims (1); res->use_name(perm_string::literal("signed"), - new VTypeArray(primitive_STDLOGIC, dims, true)); + new VTypeArray(&primitive_STDLOGIC, dims, true)); } if (all_flag || name == "unsigned") { vector dims (1); res->use_name(perm_string::literal("unsigned"), - new VTypeArray(primitive_BIT, dims, false)); + new VTypeArray(&primitive_BIT, dims, false)); } } @@ -311,12 +311,12 @@ static void import_ieee_use_numeric_std(ActiveScope*res, perm_string name) if (all_flag || name == "signed") { vector dims (1); res->use_name(perm_string::literal("signed"), - new VTypeArray(primitive_STDLOGIC, dims, true)); + new VTypeArray(&primitive_STDLOGIC, dims, true)); } if (all_flag || name == "unsigned") { vector dims (1); res->use_name(perm_string::literal("unsigned"), - new VTypeArray(primitive_STDLOGIC, dims, false)); + new VTypeArray(&primitive_STDLOGIC, dims, false)); } } @@ -343,30 +343,30 @@ static void import_ieee_use(ActiveScope*res, perm_string package, perm_string na } } -const VTypePrimitive* primitive_BOOLEAN = new VTypePrimitive(VTypePrimitive::BOOLEAN); -const VTypePrimitive* primitive_BIT = new VTypePrimitive(VTypePrimitive::BIT); -const VTypePrimitive* primitive_INTEGER = new VTypePrimitive(VTypePrimitive::INTEGER); -const VTypePrimitive* primitive_REAL = new VTypePrimitive(VTypePrimitive::REAL); -const VTypePrimitive* primitive_STDLOGIC = new VTypePrimitive(VTypePrimitive::STDLOGIC); -const VTypePrimitive* primitive_CHARACTER= new VTypePrimitive(VTypePrimitive::CHARACTER); +const VTypePrimitive primitive_BOOLEAN(VTypePrimitive::BOOLEAN); +const VTypePrimitive primitive_BIT(VTypePrimitive::BIT); +const VTypePrimitive primitive_INTEGER(VTypePrimitive::INTEGER); +const VTypePrimitive primitive_REAL(VTypePrimitive::REAL); +const VTypePrimitive primitive_STDLOGIC(VTypePrimitive::STDLOGIC); +const VTypePrimitive primitive_CHARACTER(VTypePrimitive::CHARACTER); -const VTypeRange* primitive_NATURAL = new VTypeRange(primitive_INTEGER, INT64_MAX, 0); +const VTypeRange primitive_NATURAL(&primitive_INTEGER, INT64_MAX, 0); -static const VTypeArray* primitive_BIT_VECTOR = new VTypeArray(primitive_BIT, vector (1)); -static const VTypeArray* primitive_BOOL_VECTOR = new VTypeArray(primitive_BOOLEAN, vector (1)); -static const VTypeArray* primitive_STRING = new VTypeArray(primitive_CHARACTER, vector (1)); +static const VTypeArray primitive_BIT_VECTOR(&primitive_BIT, vector (1)); +static const VTypeArray primitive_BOOL_VECTOR(&primitive_BOOLEAN, vector (1)); +static const VTypeArray primitive_STRING(&primitive_CHARACTER, vector (1)); void generate_global_types(ActiveScope*res) { - res->use_name(perm_string::literal("boolean"), primitive_BOOLEAN); - res->use_name(perm_string::literal("bit"), primitive_BIT); - res->use_name(perm_string::literal("integer"), primitive_INTEGER); - res->use_name(perm_string::literal("real"), primitive_REAL); - res->use_name(perm_string::literal("std_logic"), primitive_STDLOGIC); - res->use_name(perm_string::literal("character"), primitive_CHARACTER); - res->use_name(perm_string::literal("bit_vector"),primitive_BOOL_VECTOR); - res->use_name(perm_string::literal("string"), primitive_STRING); - res->use_name(perm_string::literal("natural"), primitive_NATURAL); + res->use_name(perm_string::literal("boolean"), &primitive_BOOLEAN); + res->use_name(perm_string::literal("bit"), &primitive_BIT); + res->use_name(perm_string::literal("integer"), &primitive_INTEGER); + res->use_name(perm_string::literal("real"), &primitive_REAL); + res->use_name(perm_string::literal("std_logic"), &primitive_STDLOGIC); + res->use_name(perm_string::literal("character"), &primitive_CHARACTER); + res->use_name(perm_string::literal("bit_vector"),&primitive_BOOL_VECTOR); + res->use_name(perm_string::literal("string"), &primitive_STRING); + res->use_name(perm_string::literal("natural"), &primitive_NATURAL); } bool is_global_type(perm_string name) diff --git a/vhdlpp/vtype.h b/vhdlpp/vtype.h index e3d0bacea..f9f66001e 100644 --- a/vhdlpp/vtype.h +++ b/vhdlpp/vtype.h @@ -143,12 +143,12 @@ class VTypePrimitive : public VType { type_t type_; }; -extern const VTypePrimitive* primitive_BOOLEAN; -extern const VTypePrimitive* primitive_BIT; -extern const VTypePrimitive* primitive_INTEGER; -extern const VTypePrimitive* primitive_REAL; -extern const VTypePrimitive* primitive_STDLOGIC; -extern const VTypePrimitive* primitive_CHARACTER; +extern const VTypePrimitive primitive_BOOLEAN; +extern const VTypePrimitive primitive_BIT; +extern const VTypePrimitive primitive_INTEGER; +extern const VTypePrimitive primitive_REAL; +extern const VTypePrimitive primitive_STDLOGIC; +extern const VTypePrimitive primitive_CHARACTER; /* * An array is a compound N-dimensional array of element type. The diff --git a/vhdlpp/vtype_stream.cc b/vhdlpp/vtype_stream.cc index 89c347d8f..987582dbc 100644 --- a/vhdlpp/vtype_stream.cc +++ b/vhdlpp/vtype_stream.cc @@ -39,7 +39,7 @@ void VType::write_type_to_stream(ostream&fd) const void VTypeArray::write_to_stream(ostream&fd) const { // Special case: std_logic_vector - if (etype_ == primitive_STDLOGIC) { + if (etype_ == &primitive_STDLOGIC) { fd << "std_logic_vector"; if (! ranges_.empty() && ! ranges_[0].is_box()) { assert(ranges_.size() < 2);