Remove "using namespace std" from tgt-vhdl header files and fix the fallout.

(cherry picked from commit 23390c1ba3)
This commit is contained in:
Martin Whitaker 2021-11-04 17:01:16 +00:00
parent 52b099feae
commit 5533ff848b
8 changed files with 36 additions and 30 deletions

View File

@ -1,7 +1,7 @@
/*
* Generate code to convert between VHDL types.
*
* Copyright (C) 2008-2012 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,6 +26,8 @@
#include <cassert>
#include <iostream>
using namespace std;
vhdl_expr *vhdl_expr::cast(const vhdl_type *to)
{
#if 0

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for expressions.
*
* Copyright (C) 2008-2013 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@
#include <cassert>
#include <cstring>
using namespace std;
/*
* Change the signedness of a vector.

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for logic devices.
*
* Copyright (C) 2008-2014 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,6 +26,8 @@
#include <sstream>
#include <iostream>
using namespace std;
/*
* Convert the inputs of a logic gate to a binary expression.
*/

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for scopes.
*
* Copyright (C) 2008-2014 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,6 +27,8 @@
#include <cassert>
#include <cstring>
using namespace std;
/*
* This represents the portion of a nexus that is visible within
* a VHDL scope. If that nexus portion does not contain a signal,

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for statements.
*
* Copyright (C) 2008-2018 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,8 @@
#include <set>
#include <algorithm>
using namespace std;
static void emit_wait_for_0(vhdl_procedural *proc, stmt_container *container,
ivl_statement_t stmt, vhdl_expr *expr);

View File

@ -1,7 +1,7 @@
/*
* VHDL code generator for Icarus Verilog.
*
* Copyright (C) 2008-2020 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,6 +31,8 @@
#include <cstring>
#include <cstdlib>
using namespace std;
static const char*version_string =
"Icarus Verilog VHDL Code Generator " VERSION " (" VERSION_TAG ")\n\n"
"Copyright (C) 2008-2020 Nick Gasson (nick@nickg.me.uk)\n\n"

View File

@ -27,14 +27,12 @@
#include "vhdl_element.hh"
#include "vhdl_type.hh"
using namespace std;
class vhdl_scope;
class vhdl_entity;
class vhdl_arch;
class vhdl_var_ref;
typedef set<vhdl_var_ref*> vhdl_var_set_t;
typedef std::set<vhdl_var_ref*> vhdl_var_set_t;
class vhdl_expr : public vhdl_element {
public:
@ -56,8 +54,8 @@ public:
virtual void find_vars(vhdl_var_set_t&) {}
protected:
static void open_parens(ostream& of);
static void close_parens(ostream& of);
static void open_parens(std::ostream& of);
static void close_parens(std::ostream& of);
static int paren_levels;
const vhdl_type *type_;
@ -70,7 +68,7 @@ protected:
*/
class vhdl_var_ref : public vhdl_expr {
public:
vhdl_var_ref(const string& name, const vhdl_type *type,
vhdl_var_ref(const std::string& name, const vhdl_type *type,
vhdl_expr *slice = NULL)
: vhdl_expr(type), name_(name), slice_(slice), slice_width_(0) {}
~vhdl_var_ref();
@ -178,7 +176,7 @@ private:
class vhdl_const_string : public vhdl_expr {
public:
explicit vhdl_const_string(const string& value)
explicit vhdl_const_string(const std::string& value)
: vhdl_expr(vhdl_type::string(), true), value_(value) {}
void emit(std::ostream &of, int level) const;
@ -272,7 +270,7 @@ private:
*/
class vhdl_fcall : public vhdl_expr {
public:
vhdl_fcall(const string& name, const vhdl_type *rtype)
vhdl_fcall(const std::string& name, const vhdl_type *rtype)
: vhdl_expr(rtype), name_(name) {};
~vhdl_fcall() {}
@ -468,7 +466,7 @@ public:
vhdl_severity_t severity = SEVERITY_NOTE);
virtual ~vhdl_report_stmt() {}
virtual void emit(ostream& of, int level) const;
virtual void emit(std::ostream& of, int level) const;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
private:
vhdl_severity_t severity_;
@ -480,7 +478,7 @@ class vhdl_assert_stmt : public vhdl_report_stmt {
public:
explicit vhdl_assert_stmt(const char *reason);
void emit(ostream &of, int level) const;
void emit(std::ostream &of, int level) const;
};
@ -602,8 +600,8 @@ private:
*/
class vhdl_decl : public vhdl_element {
public:
vhdl_decl(const string& name, const vhdl_type *type = NULL,
vhdl_expr *initial = NULL)
explicit vhdl_decl(const std::string& name, const vhdl_type *type = NULL,
vhdl_expr *initial = NULL)
: name_(name), type_(type), initial_(initial),
has_initial_(initial != NULL) {}
virtual ~vhdl_decl();
@ -666,7 +664,7 @@ private:
class vhdl_type_decl : public vhdl_decl {
public:
vhdl_type_decl(const string& name, const vhdl_type *base)
vhdl_type_decl(const std::string& name, const vhdl_type *base)
: vhdl_decl(name, base) {}
void emit(std::ostream &of, int level) const;
};
@ -677,7 +675,7 @@ public:
*/
class vhdl_var_decl : public vhdl_decl {
public:
vhdl_var_decl(const string& name, const vhdl_type *type)
vhdl_var_decl(const std::string& name, const vhdl_type *type)
: vhdl_decl(name, type) {}
void emit(std::ostream &of, int level) const;
assign_type_t assignment_type() const { return ASSIGN_BLOCK; }
@ -689,7 +687,7 @@ public:
*/
class vhdl_signal_decl : public vhdl_decl {
public:
vhdl_signal_decl(const string& name, const vhdl_type* type)
vhdl_signal_decl(const std::string& name, const vhdl_type* type)
: vhdl_decl(name, type) {}
virtual void emit(std::ostream &of, int level) const;
assign_type_t assignment_type() const { return ASSIGN_NONBLOCK; }
@ -755,7 +753,7 @@ public:
~vhdl_comp_inst();
void emit(std::ostream &of, int level) const;
void map_port(const string& name, vhdl_expr *expr);
void map_port(const std::string& name, vhdl_expr *expr);
const std::string &get_comp_name() const { return comp_name_; }
const std::string &get_inst_name() const { return inst_name_; }
@ -779,7 +777,7 @@ public:
void add_forward_decl(vhdl_decl *decl);
vhdl_decl *get_decl(const std::string &name) const;
bool have_declared(const std::string &name) const;
bool name_collides(const string& name) const;
bool name_collides(const std::string& name) const;
bool contained_within(const vhdl_scope *other) const;
vhdl_scope *get_parent() const;
@ -834,7 +832,7 @@ protected:
// The set of variable we have performed a blocking
// assignment to
set<string> blocking_targets_;
std::set<std::string> blocking_targets_;
};
@ -878,7 +876,7 @@ private:
*/
class vhdl_arch : public vhdl_element {
public:
vhdl_arch(const string& entity, const string& name)
vhdl_arch(const std::string& entity, const std::string& name)
: name_(name), entity_(entity) {}
virtual ~vhdl_arch();
@ -900,7 +898,7 @@ private:
*/
class vhdl_entity : public vhdl_element {
public:
vhdl_entity(const string& name, vhdl_arch *arch, int depth=0);
vhdl_entity(const std::string& name, vhdl_arch *arch, int depth=0);
virtual ~vhdl_entity();
void emit(std::ostream &of, int level=0) const;
@ -930,4 +928,3 @@ private:
typedef std::list<vhdl_entity*> entity_list_t;
#endif

View File

@ -10,8 +10,6 @@
#include <string>
using namespace std;
void error(const char *fmt, ...);
void debug_msg(const char *fmt, ...);
@ -28,7 +26,7 @@ vhdl_expr *translate_time_expr(ivl_expr_t e);
ivl_design_t get_vhdl_design();
vhdl_var_ref *nexus_to_var_ref(vhdl_scope *arch_scope, ivl_nexus_t nexus);
vhdl_var_ref* readable_ref(vhdl_scope* scope, ivl_nexus_t nex);
string make_safe_name(ivl_signal_t sig);
std::string make_safe_name(ivl_signal_t sig);
void require_support_function(support_function_t f);
#endif /* #ifndef INC_VHDL_TARGET_H */