Remove "using namespace std" from vvp header files and fix the fallout.

This commit is contained in:
Martin Whitaker 2021-11-04 17:02:07 +00:00
parent 23390c1ba3
commit 9cc09b8513
23 changed files with 57 additions and 49 deletions

View File

@ -19,14 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#if defined(__cplusplus)
# if !defined(__GNUC__)
using namespace std;
# elif (__GNUC__ == 3)
using namespace std;
# endif
#endif
# undef HAVE_STDINT_H # undef HAVE_STDINT_H
# undef HAVE_INTTYPES_H # undef HAVE_INTTYPES_H

View File

@ -25,6 +25,8 @@
# include <cstdlib> # include <cstdlib>
# include <cmath> # include <cmath>
using namespace std;
vvp_arith_::vvp_arith_(unsigned wid) vvp_arith_::vvp_arith_(unsigned wid)
: wid_(wid), op_a_(wid), op_b_(wid), x_val_(wid) : wid_(wid), op_a_(wid), op_b_(wid), x_val_(wid)
{ {

View File

@ -36,6 +36,8 @@
# include <cassert> # include <cassert>
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
unsigned long count_net_arrays = 0; unsigned long count_net_arrays = 0;
unsigned long count_net_array_words = 0; unsigned long count_net_array_words = 0;
unsigned long count_var_arrays = 0; unsigned long count_var_arrays = 0;

View File

@ -1,7 +1,7 @@
#ifndef IVL_compile_H #ifndef IVL_compile_H
#define IVL_compile_H #define IVL_compile_H
/* /*
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -27,13 +27,11 @@
# include "sv_vpi_user.h" # include "sv_vpi_user.h"
# include "vvp_net.h" # include "vvp_net.h"
using namespace std;
/* /*
* The file names are kept in this vector. Entry 0 is "N/A" and 1 is * The file names are kept in this vector. Entry 0 is "N/A" and 1 is
* for interactive commands. * for interactive commands.
*/ */
extern vector<const char*> file_names; extern std::vector<const char*> file_names;
/* /*
* The functions described here are the compile time support * The functions described here are the compile time support
@ -54,7 +52,7 @@ extern bool verbose_flag;
* If this file opened, then write debug information to this * If this file opened, then write debug information to this
* file. This is used for debugging the VVP runtime itself. * file. This is used for debugging the VVP runtime itself.
*/ */
extern ofstream debug_file; extern std::ofstream debug_file;
/* /*
* Connect a list of symbols to a contiguous set of ipoints. * Connect a list of symbols to a contiguous set of ipoints.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2004-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,7 @@
# include <iostream> # include <iostream>
# include <cassert> # include <cassert>
using namespace std;
vvp_fun_concat::vvp_fun_concat(unsigned w0, unsigned w1, vvp_fun_concat::vvp_fun_concat(unsigned w0, unsigned w1,
unsigned w2, unsigned w3) unsigned w2, unsigned w3)

View File

@ -19,14 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#if defined(__cplusplus)
# if !defined(__GNUC__)
using namespace std;
# elif (__GNUC__ == 3)
using namespace std;
# endif
#endif
# define SIZEOF_UNSIGNED_LONG_LONG 0 # define SIZEOF_UNSIGNED_LONG_LONG 0
#ifndef SIZEOF_UNSIGNED_LONG #ifndef SIZEOF_UNSIGNED_LONG
# define SIZEOF_UNSIGNED_LONG 0 # define SIZEOF_UNSIGNED_LONG 0

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005-2020 Stephen Williams <steve@icarus.com> * Copyright (c) 2005-2021 Stephen Williams <steve@icarus.com>
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -31,6 +31,8 @@
#include <cmath> #include <cmath>
#include "ivl_alloc.h" #include "ivl_alloc.h"
using namespace std;
void vvp_delay_t::calculate_min_delay_() void vvp_delay_t::calculate_min_delay_()
{ {
min_delay_ = rise_; min_delay_ = rise_;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2012 Stephen Williams (steve@icarus.com) * Copyright (c) 2010-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -25,6 +25,8 @@
# include <iostream> # include <iostream>
# include <cassert> # include <cassert>
using namespace std;
struct enumconst_s : public __vpiHandle { struct enumconst_s : public __vpiHandle {
enumconst_s(); enumconst_s();
int get_type_code(void) const; int get_type_code(void) const;

View File

@ -49,6 +49,8 @@ const char COPYRIGHT[] =
# include <windows.h> # include <windows.h>
#endif #endif
using namespace std;
ofstream debug_file; ofstream debug_file;
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H) #if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)

View File

@ -1,7 +1,7 @@
%{ %{
/* /*
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-202` Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@
# include "ivl_alloc.h" # include "ivl_alloc.h"
# include "version_base.h" # include "version_base.h"
using namespace std;
/* /*
* These are bits in the lexor. * These are bits in the lexor.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2004-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -26,6 +26,8 @@
# include <iostream> # include <iostream>
# include <cassert> # include <cassert>
using namespace std;
struct vvp_fun_part_state_s { struct vvp_fun_part_state_s {
vvp_fun_part_state_s() : bitsr(0.0) {} vvp_fun_part_state_s() : bitsr(0.0) {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -25,6 +25,7 @@
# include <algorithm> # include <algorithm>
# include <cassert> # include <cassert>
using namespace std;
/* /*
* The core functor for a resolver node stores all the input values * The core functor for a resolver node stores all the input values

View File

@ -35,6 +35,8 @@
# include "ivl_alloc.h" # include "ivl_alloc.h"
#endif #endif
using namespace std;
unsigned long count_assign_events = 0; unsigned long count_assign_events = 0;
unsigned long count_gen_events = 0; unsigned long count_gen_events = 0;
unsigned long count_thread_events = 0; unsigned long count_thread_events = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 2005-2021 Stephen Williams (steve@icarus.com)
* *
* (This is a rewrite of code that was ... * (This is a rewrite of code that was ...
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>) * Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>)
@ -35,6 +35,8 @@
#include "ivl_alloc.h" #include "ivl_alloc.h"
#endif #endif
using namespace std;
// We may need these later when we build the VPI interface to // We may need these later when we build the VPI interface to
// UDP definitions. // UDP definitions.
#ifdef CHECK_WITH_VALGRIND #ifdef CHECK_WITH_VALGRIND

View File

@ -1,7 +1,7 @@
#ifndef IVL_udp_H #ifndef IVL_udp_H
#define IVL_udp_H #define IVL_udp_H
/* /*
* Copyright (c) 2005-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2005-2021 Stephen Williams (steve@icarus.com)
* *
* (This is a rewrite of code that was ... * (This is a rewrite of code that was ...
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>) * Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>)
@ -109,7 +109,7 @@ struct udp_levels_table {
unsigned long mask1; unsigned long mask1;
unsigned long maskx; unsigned long maskx;
}; };
extern ostream& operator<< (ostream&o, const struct udp_levels_table&t); extern std::ostream& operator<< (std::ostream&o, const struct udp_levels_table&t);
class vvp_udp_comb_s : public vvp_udp_s { class vvp_udp_comb_s : public vvp_udp_s {

View File

@ -37,6 +37,9 @@
# include <cstdio> # include <cstdio>
# include <cassert> # include <cassert>
# include <cstdlib> # include <cstdlib>
using namespace std;
/* /*
* Callback handles are created when the VPI function registers a * Callback handles are created when the VPI function registers a
* callback. The handle is stored by the run time, and it triggered * callback. The handle is stored by the run time, and it triggered

View File

@ -35,6 +35,8 @@
# include <cassert> # include <cassert>
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
/* /*
* Hex digits that represent 4-value bits of Verilog are not as * Hex digits that represent 4-value bits of Verilog are not as
* trivially obvious to display as if the bits were the usual 2-value * trivially obvious to display as if the bits were the usual 2-value

View File

@ -1,7 +1,7 @@
#ifndef IVL_vvp_darray_H #ifndef IVL_vvp_darray_H
#define IVL_vvp_darray_H #define IVL_vvp_darray_H
/* /*
* Copyright (c) 2012-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -247,6 +247,6 @@ class vvp_queue_vec4 : public vvp_queue {
std::deque<vvp_vector4_t> queue; std::deque<vvp_vector4_t> queue;
}; };
extern string get_fileline(); extern std::string get_fileline();
#endif /* IVL_vvp_darray_H */ #endif /* IVL_vvp_darray_H */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -32,6 +32,8 @@
# include <cstring> # include <cstring>
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
static bool at_EOS = false; static bool at_EOS = false;
void island_send_value(vvp_net_t*net, const vvp_vector8_t&val) void island_send_value(vvp_net_t*net, const vvp_vector8_t&val)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2004-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -41,6 +41,8 @@
# include "ivl_alloc.h" # include "ivl_alloc.h"
#endif #endif
using namespace std;
/* This is the size of an unsigned long in bits. This is just a /* This is the size of an unsigned long in bits. This is just a
convenience macro. */ convenience macro. */
# define CPU_WORD_BITS (8*sizeof(unsigned long)) # define CPU_WORD_BITS (8*sizeof(unsigned long))

View File

@ -34,14 +34,11 @@
#ifdef HAVE_IOSFWD #ifdef HAVE_IOSFWD
# include <iosfwd> # include <iosfwd>
#else #else
class ostream; # include <iostream>
#endif #endif
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
/* Data types */ /* Data types */
class vvp_scalar_t; class vvp_scalar_t;
@ -186,7 +183,7 @@ inline vvp_bit4_t operator & (vvp_bit4_t a, vvp_bit4_t b)
extern vvp_bit4_t operator ^ (vvp_bit4_t a, vvp_bit4_t b); extern vvp_bit4_t operator ^ (vvp_bit4_t a, vvp_bit4_t b);
extern ostream& operator<< (ostream&o, vvp_bit4_t a); extern std::ostream& operator<< (std::ostream&o, vvp_bit4_t a);
/* Return >0, ==0 or <0 if the from-to transition represents a /* Return >0, ==0 or <0 if the from-to transition represents a
posedge, no edge, or negedge. */ posedge, no edge, or negedge. */
@ -529,7 +526,7 @@ inline vvp_vector4_t operator ~ (const vvp_vector4_t&that)
return res; return res;
} }
extern ostream& operator << (ostream&, const vvp_vector4_t&); extern std::ostream& operator << (std::ostream&, const vvp_vector4_t&);
extern vvp_bit4_t compare_gtge(const vvp_vector4_t&a, extern vvp_bit4_t compare_gtge(const vvp_vector4_t&a,
const vvp_vector4_t&b, const vvp_vector4_t&b,
@ -739,7 +736,7 @@ extern vvp_vector4_t c4string_to_vector4(const char*str);
extern bool crstring_test(const char*str); extern bool crstring_test(const char*str);
extern double crstring_to_double(const char*str); extern double crstring_to_double(const char*str);
extern ostream& operator<< (ostream&, const vvp_vector2_t&); extern std::ostream& operator<< (std::ostream&, const vvp_vector2_t&);
inline vvp_vector2_t::vvp_vector2_t(const vvp_vector2_t&that) inline vvp_vector2_t::vvp_vector2_t(const vvp_vector2_t&that)
{ {
@ -892,7 +889,7 @@ inline vvp_scalar_t resolve(vvp_scalar_t a, vvp_scalar_t b)
return fully_featured_resolv_(a,b); return fully_featured_resolv_(a,b);
} }
extern ostream& operator<< (ostream&, vvp_scalar_t); extern std::ostream& operator<< (std::ostream&, vvp_scalar_t);
/* /*
* This class is a way to carry vectors of strength modeled * This class is a way to carry vectors of strength modeled
@ -976,7 +973,7 @@ extern bool c8string_test(const char*str);
extern vvp_vector8_t c8string_to_vector8(const char*str); extern vvp_vector8_t c8string_to_vector8(const char*str);
/* Print a vector8 value to a stream. */ /* Print a vector8 value to a stream. */
extern ostream& operator<< (ostream&, const vvp_vector8_t&); extern std::ostream& operator<< (std::ostream&, const vvp_vector8_t&);
inline vvp_vector8_t::vvp_vector8_t(unsigned size__) inline vvp_vector8_t::vvp_vector8_t(unsigned size__)
: size_(size__) : size_(size__)
@ -1075,7 +1072,7 @@ template <class T> class vvp_sub_pointer_t {
}; };
typedef vvp_sub_pointer_t<vvp_net_t> vvp_net_ptr_t; typedef vvp_sub_pointer_t<vvp_net_t> vvp_net_ptr_t;
template <class T> ostream& operator << (ostream&out, vvp_sub_pointer_t<T> val) template <class T> std::ostream& operator << (std::ostream&out, vvp_sub_pointer_t<T> val)
{ out << val.ptr() << "[" << val.port() << "]"; return out; } { out << val.ptr() << "[" << val.port() << "]"; return out; }
/* /*

View File

@ -1,7 +1,7 @@
#ifndef IVL_vvp_net_sig_H #ifndef IVL_vvp_net_sig_H
#define IVL_vvp_net_sig_H #define IVL_vvp_net_sig_H
/* /*
* Copyright (c) 2004-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2004-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -33,11 +33,9 @@
#ifdef HAVE_IOSFWD #ifdef HAVE_IOSFWD
# include <iosfwd> # include <iosfwd>
#else #else
class ostream; # include <iostream>
#endif #endif
using namespace std;
/* vvp_fun_signal /* vvp_fun_signal
* This node is the place holder in a vvp network for signals, * This node is the place holder in a vvp network for signals,
* including nets of various sort. The output from a signal follows * including nets of various sort. The output from a signal follows

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -32,6 +32,8 @@
# include <iostream> # include <iostream>
# include <cassert> # include <cassert>
using namespace std;
static void __compile_var_real(char*label, char*name, static void __compile_var_real(char*label, char*name,
vvp_array_t array, unsigned long array_addr) vvp_array_t array, unsigned long array_addr)
{ {