V0.9: Remove clang/clang++ warnings.

This patch makes the code consistently use struct/class in the C++ files,
it removes a couple shadow warnings and where a class pointer is passed to
the C routines it defines the pointer as a class for C++ and as struct for C.
This commit is contained in:
Cary R 2011-09-22 18:47:05 -07:00 committed by Stephen Williams
parent 5c6c8deba3
commit 4f2a41f186
9 changed files with 42 additions and 29 deletions

View File

@ -1,7 +1,7 @@
#ifndef __ivl_target_H
#define __ivl_target_H
/*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -158,7 +158,15 @@ typedef struct ivl_array_s *ivl_array_t;
typedef struct ivl_branch_s *ivl_branch_t;
typedef struct ivl_delaypath_s*ivl_delaypath_t;
typedef struct ivl_design_s *ivl_design_t;
/* clang++ wants this to be class to match the definition, but clang
* (the C) compiler needs it to be a struct since class is not defined
* in C. They are effecively both pointers to an object so everything
* works out. */
#ifdef __cplusplus
typedef class ivl_discipline_s*ivl_discipline_t;
#else
typedef struct ivl_discipline_s*ivl_discipline_t;
#endif
typedef struct ivl_event_s *ivl_event_t;
typedef struct ivl_expr_s *ivl_expr_t;
typedef struct ivl_island_s *ivl_island_t;
@ -167,7 +175,12 @@ typedef struct ivl_lval_s *ivl_lval_t;
typedef struct ivl_net_const_s*ivl_net_const_t;
typedef struct ivl_net_logic_s*ivl_net_logic_t;
typedef struct ivl_udp_s *ivl_udp_t;
/* See the comments above. */
#ifdef __cplusplus
typedef class ivl_nature_s *ivl_nature_t;
#else
typedef struct ivl_nature_s *ivl_nature_t;
#endif
typedef struct ivl_net_probe_s*ivl_net_probe_t;
typedef struct ivl_nexus_s *ivl_nexus_t;
typedef struct ivl_nexus_ptr_s*ivl_nexus_ptr_t;

View File

@ -1,7 +1,7 @@
#ifndef __codes_H
#define __codes_H
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -184,7 +184,7 @@ struct vvp_code_s {
uint32_t bit_idx[2];
vvp_net_t *net2;
vvp_code_t cptr2;
struct ufunc_core*ufunc_core_ptr;
class ufunc_core*ufunc_core_ptr;
};
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -325,14 +325,14 @@ vvp_net_t* vvp_net_lookup(const char*label)
* this call is its last chance. If it cannot complete the operation,
* it must print an error message and return false.
*/
static struct resolv_list_s*resolv_list = 0;
static class resolv_list_s*resolv_list = 0;
resolv_list_s::~resolv_list_s()
{
free(label_);
}
void resolv_submit(struct resolv_list_s*cur)
void resolv_submit(class resolv_list_s*cur)
{
if (cur->resolve()) {
delete cur;
@ -613,13 +613,13 @@ void compile_cleanup(void)
}
do {
struct resolv_list_s *res = resolv_list;
class resolv_list_s *res = resolv_list;
resolv_list = 0x0;
last = nerrs == lnerrs;
lnerrs = nerrs;
nerrs = 0;
while (res) {
struct resolv_list_s *cur = res;
class resolv_list_s *cur = res;
res = res->next;
if (cur->resolve(last))
delete cur;

View File

@ -1,7 +1,7 @@
#ifndef __compile_H
#define __compile_H
/*
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -196,7 +196,7 @@ extern void compile_dff(char*label,
struct symb_s arg_e,
struct symb_s arg_a);
class __vpiModPath;
struct __vpiModPath;
extern __vpiModPath* compile_modpath(char*label,
struct symb_s drv,
struct symb_s dest);
@ -277,11 +277,11 @@ class resolv_list_s {
const char*label() const { return label_; }
private:
friend void resolv_submit(struct resolv_list_s*cur);
friend void resolv_submit(class resolv_list_s*cur);
friend void compile_cleanup(void);
char*label_;
struct resolv_list_s*next;
class resolv_list_s*next;
};
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -163,9 +163,9 @@ inline void* assign_vector4_event_s::operator new(size_t size)
return assign4_heap.alloc_slab();
}
void assign_vector4_event_s::operator delete(void*ptr)
void assign_vector4_event_s::operator delete(void*dptr)
{
assign4_heap.free_slab(ptr);
assign4_heap.free_slab(dptr);
}
unsigned long count_assign4_pool(void) { return assign4_heap.pool; }
@ -194,9 +194,9 @@ inline void* assign_vector8_event_s::operator new(size_t size)
return assign8_heap.alloc_slab();
}
void assign_vector8_event_s::operator delete(void*ptr)
void assign_vector8_event_s::operator delete(void*dptr)
{
assign8_heap.free_slab(ptr);
assign8_heap.free_slab(dptr);
}
unsigned long count_assign8_pool() { return assign8_heap.pool; }
@ -225,9 +225,9 @@ inline void* assign_real_event_s::operator new (size_t size)
return assignr_heap.alloc_slab();
}
void assign_real_event_s::operator delete(void*ptr)
void assign_real_event_s::operator delete(void*dptr)
{
assignr_heap.free_slab(ptr);
assignr_heap.free_slab(dptr);
}
unsigned long count_assign_real_pool(void) { return assignr_heap.pool; }

View File

@ -1,7 +1,7 @@
#ifndef __vpi_priv_H
#define __vpi_priv_H
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -425,7 +425,7 @@ struct __vpiSysTaskCall {
/* These represent where in the vthread to put the return value. */
unsigned vbit;
signed vwid;
class vvp_net_t*fnet;
struct vvp_net_t*fnet;
unsigned file_idx;
unsigned lineno;
bool put_value;
@ -528,7 +528,7 @@ extern unsigned vpip_module_path_cnt;
*/
extern vpiHandle vpip_build_vpi_call(const char*name,
unsigned vbit, int vwid,
class vvp_net_t*fnet,
struct vvp_net_t*fnet,
unsigned argc,
vpiHandle*argv,
long file_idx,

View File

@ -634,7 +634,7 @@ static void cleanup_vpi_call_args(unsigned argc, vpiHandle*argv)
* vbit is also a non-zero value, the address in thread space of the result.
*/
vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, int vwid,
class vvp_net_t*fnet,
struct vvp_net_t*fnet,
unsigned argc, vpiHandle*argv,
long file_idx, long lineno)
{

View File

@ -1,7 +1,7 @@
#ifndef __vvp_island_H
#define __vvp_island_H
/*
* Copyright (c) 2008,2011 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -53,7 +53,7 @@
* branches of analog within the island.
*/
class vvp_island_branch;
struct vvp_island_branch;
class vvp_island_node;
class vvp_island : private vvp_gen_event_s {

View File

@ -1,7 +1,7 @@
#ifndef __vvp_net_H
#define __vvp_net_H
/*
* Copyright (c) 2004-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -40,7 +40,7 @@ using namespace std;
class vvp_scalar_t;
/* Basic netlist types. */
class vvp_net_t;
struct vvp_net_t;
class vvp_net_fun_t;
/* Core net function types. */
@ -1220,10 +1220,10 @@ class vvp_vpi_callback_wordable : public vvp_vpi_callback {
~vvp_vpi_callback_wordable();
void run_vpi_callbacks();
void attach_as_word(class __vpiArray* arr, unsigned long addr);
void attach_as_word(struct __vpiArray* arr, unsigned long addr);
private:
class __vpiArray* array_;
struct __vpiArray* array_;
unsigned long array_word_;
};