Skip to content

Commit

Permalink
Remove malloc.h support and for C++ files use <c...> include files.
Browse files Browse the repository at this point in the history
The functions (malloc, free, etc.) that used to be provided in
malloc.h are now provided in cstdlib for C++ files and stdlib.h for
C files. Since we require a C99 compliant compiler it makes sense
that malloc.h is no longer needed.

This patch also modifies all the C++ files to use the <c...>
version of the standard C header files (e.g. <cstdlib> vs
<stdlib.h>). Some of the files used the C++ version and others did
not. There are still a few other header changes that could be done,
but this takes care of much of it.
  • Loading branch information
caryr authored and steveicarus committed Jun 1, 2010
1 parent 8122432 commit 1993bf6
Show file tree
Hide file tree
Showing 129 changed files with 299 additions and 871 deletions.
4 changes: 2 additions & 2 deletions Attrib.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2010 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
Expand All @@ -20,7 +20,7 @@
# include "config.h"

# include "Attrib.h"
# include <assert.h>
# include <cassert>

Attrib::Attrib()
{
Expand Down
6 changes: 1 addition & 5 deletions HName.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 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
Expand All @@ -23,9 +23,6 @@
# include <cstring>
# include <cstdlib>
# include <climits>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif


hname_t::hname_t()
Expand Down Expand Up @@ -94,4 +91,3 @@ ostream& operator<< (ostream&out, const hname_t&that)

return out;
}

2 changes: 1 addition & 1 deletion Module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# include "Module.h"
# include "PGate.h"
# include "PWire.h"
# include <assert.h>
# include <cassert>

list<Module::named_expr_t> Module::user_defparms;

Expand Down
5 changes: 2 additions & 3 deletions PGate.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2007 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 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
Expand All @@ -22,7 +22,7 @@
# include "PGate.h"
# include "PExpr.h"
# include "verinum.h"
# include <assert.h>
# include <cassert>

PGate::PGate(perm_string name,
svector<PExpr*>*pins,
Expand Down Expand Up @@ -189,4 +189,3 @@ perm_string PGModule::get_type()
{
return type_;
}

4 changes: 2 additions & 2 deletions PWire.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 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
Expand All @@ -20,7 +20,7 @@
# include "config.h"
# include "PWire.h"
# include "PExpr.h"
# include <assert.h>
# include <cassert>

PWire::PWire(perm_string n,
NetNet::Type t,
Expand Down
11 changes: 4 additions & 7 deletions StringHeap.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2010 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
Expand All @@ -18,12 +18,9 @@
*/

# include "StringHeap.h"
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
# include <stdlib.h>
# include <string.h>
# include <assert.h>
# include <cstdlib>
# include <cstring>
# include <cassert>

#ifdef CHECK_WITH_VALGRIND
static char **string_pool = NULL;
Expand Down
4 changes: 2 additions & 2 deletions async.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2010 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
Expand All @@ -21,7 +21,7 @@

# include "functor.h"
# include "netlist.h"
# include <assert.h>
# include <cassert>

bool NetAssign::is_asynchronous()
{
Expand Down
5 changes: 1 addition & 4 deletions cadpli/cadpli.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2010 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
Expand All @@ -20,9 +20,6 @@
# include <vpi_user.h>
# include <veriuser.h>
# include <stdlib.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
# include <string.h>
# include <assert.h>
# include "config.h"
Expand Down
1 change: 0 additions & 1 deletion config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
# undef HAVE_GETOPT_H
# undef HAVE_INTTYPES_H
# undef HAVE_LIBIBERTY_H
# undef HAVE_MALLOC_H
# undef HAVE_DLFCN_H
# undef HAVE_DL_H
# undef HAVE_FCHMOD
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ else
fi
fi

AC_CHECK_HEADERS(getopt.h malloc.h inttypes.h libiberty.h iosfwd sys/wait.h)
AC_CHECK_HEADERS(getopt.h inttypes.h libiberty.h iosfwd sys/wait.h)

AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned long)
Expand Down
5 changes: 1 addition & 4 deletions driver/substit.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2010 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
Expand All @@ -20,9 +20,6 @@
# include <string.h>
# include <stdlib.h>
# include <stdio.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif


char* substitutions(const char*str)
Expand Down
4 changes: 2 additions & 2 deletions dup_expr.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 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
Expand All @@ -21,7 +21,7 @@

# include "netlist.h"
# include <cassert>
# include <stdlib.h>
# include <cstdlib>
# include "ivl_assert.h"

NetEAccess* NetEAccess::dup_expr() const
Expand Down
4 changes: 2 additions & 2 deletions elab_scope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# include <cstring>
# include <iostream>
# include <cstdlib>
# include <stdio.h>
# include <cstdio>

/*
* Elaboration happens in two passes, generally. The first scans the
Expand All @@ -44,7 +44,7 @@
# include "netlist.h"
# include "util.h"
# include <typeinfo>
# include <assert.h>
# include <cassert>
# include "ivl_assert.h"

typedef map<perm_string,LexicalScope::param_expr_t>::const_iterator mparm_it_t;
Expand Down
5 changes: 2 additions & 3 deletions eval_attrib.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2004 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2010 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
Expand All @@ -22,7 +22,7 @@
# include "PExpr.h"
# include "netlist.h"
# include <iostream>
# include <assert.h>
# include <cassert>

/*
* The evaluate_attributes function evaluates the attribute
Expand Down Expand Up @@ -72,4 +72,3 @@ attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
assert(idx == natt);
return table;
}

2 changes: 1 addition & 1 deletion eval_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# include <iostream>
# include <cstdlib>
# include <cstring>
# include <math.h>
# include <cmath>

# include "netlist.h"
# include "ivl_assert.h"
Expand Down
4 changes: 2 additions & 2 deletions ivl_assert.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2010 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
Expand All @@ -20,7 +20,7 @@
#ifndef __ivl_assert_h
#define __ivl_assert_h

# include <assert.h>
# include <cassert>

#define ivl_assert(tok, expression) \
do { \
Expand Down
3 changes: 0 additions & 3 deletions ivlpp/lexor.lex
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
# include "config.h"

# include <stdio.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
Expand Down
3 changes: 0 additions & 3 deletions ivlpp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ const char NOTICE[] =

# include <stdio.h>
# include <stdlib.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
# include <unistd.h>
# include <string.h>
# include <ctype.h>
Expand Down
6 changes: 3 additions & 3 deletions lexor.lex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

%{
/*
* Copyright (c) 1998-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2010 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
Expand All @@ -31,8 +31,8 @@
# include "parse_misc.h"
# include "parse_api.h"
# include "parse.h"
# include <ctype.h>
# include <string.h>
# include <cctype>
# include <cstring>
# include "lexor_keyword.h"
# include "discipline.h"
# include <list>
Expand Down
2 changes: 1 addition & 1 deletion lexor_keyword.gperf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "config.h"
#include "parse_misc.h"
#include "parse.h"
#include <string.h>
#include <cstring>
#include "lexor_keyword.h"
#include "compiler.h"

Expand Down
5 changes: 1 addition & 4 deletions libveriuser/a_vcl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2010 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
Expand All @@ -20,9 +20,6 @@
#include <vpi_user.h>
#include <acc_user.h>
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "priv.h"
#include <assert.h>

Expand Down
18 changes: 1 addition & 17 deletions libveriuser/workarea.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2010 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
Expand All @@ -16,16 +16,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: workarea.c,v 1.1 2002/12/19 21:37:04 steve Exp $"
#endif

# include <veriuser.h>
# include <vpi_user.h>
# include <stdlib.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif

/*
* Keep a list of sys handle to work area bindings.
Expand Down Expand Up @@ -82,13 +76,3 @@ PLI_BYTE8* tf_getworkarea(void)

return 0;
}

/*
* $Log: workarea.c,v $
* Revision 1.1 2002/12/19 21:37:04 steve
* Add tf_message, tf_get/setworkarea, and
* ty_typep functions, along with defines
* related to these functions.
*
*/

6 changes: 3 additions & 3 deletions load_module.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 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
Expand Down Expand Up @@ -28,8 +28,8 @@
# include <string>
# include <sys/types.h>
# include <dirent.h>
# include <ctype.h>
# include <assert.h>
# include <cctype>
# include <cassert>

/*
* The module library items are maps of key names to file name within
Expand Down
Loading

0 comments on commit 1993bf6

Please sign in to comment.