From f42f6705998596542ceadc46940ab6acd42e6d3a Mon Sep 17 00:00:00 2001 From: stevewilliams Date: Sat, 3 Feb 2001 00:19:15 +0000 Subject: [PATCH] Remove all references to the GC library, replacing GC_malloc with calloc. Remove ALLOC_ATOMIC and replace with ALLOC, and clean up the Makefile/configure stuff related to libgc. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@568 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- Makefile | 9 -- Makefile.common.in | 10 -- configure | 311 +++++++++++++++++-------------------- configure.in | 16 +- debugger/mcs51/Makefile.in | 9 -- debugger/mcs51/break.c | 4 +- debugger/mcs51/sdcdb.c | 4 +- debugger/mcs51/sdcdb.h | 5 +- sdcc_vc.h | 2 - sdccconf_in.h | 1 - src/Makefile.in | 9 -- src/SDCC.lex | 2 +- src/SDCC.y | 2 +- src/SDCCBBlock.c | 12 +- src/SDCCalloc.h | 35 ----- src/SDCCast.c | 2 +- src/SDCCbitv.c | 2 +- src/SDCCglobl.h | 13 +- src/SDCCglue.c | 6 +- src/SDCChasht.c | 10 +- src/SDCChasht.h | 1 - src/SDCCmain.c | 4 +- src/SDCCmem.c | 2 +- src/SDCCpeeph.c | 14 +- src/SDCCset.c | 9 +- src/SDCCset.h | 2 - src/SDCCval.c | 2 +- src/ds390/gen.c | 11 +- src/mcs51/gen.c | 10 +- src/z80/gen.c | 21 +-- support/cpp/cppalloc.c | 3 + 31 files changed, 219 insertions(+), 324 deletions(-) delete mode 100644 src/SDCCalloc.h diff --git a/Makefile b/Makefile index e24d2706..9efd710e 100644 --- a/Makefile +++ b/Makefile @@ -29,15 +29,6 @@ all: checkconf sdcc tini: checkconf sdcc-tini sdcc-libs: -ifeq ($(DISABLE_GC),1) - : skip boehm library when disabled by hand. -else -ifeq ($(CROSS_LIBGC),1) - $(MAKE) -C support/gc -f Makefile.cross -else - $(MAKE) -C support/gc -endif -endif for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done sdcc-cc: sdcc-libs diff --git a/Makefile.common.in b/Makefile.common.in index 21371161..55bb167f 100644 --- a/Makefile.common.in +++ b/Makefile.common.in @@ -34,18 +34,8 @@ infodir = @infodir@ srcdir = @srcdir@ # Flags -HAVE_LIBGC = @HAVE_LIBGC@ -DISABLE_GC = @DISABLE_GC@ DEFS = $(subs -DHAVE_CONFIG_H,,@DEFS@) CPPFLAGS = @CPPFLAGS@ -I$(PRJDIR) -ifeq ($(DISABLE_GC),1) -# Skip the Boehm GC library in special, manually configured cases. -else -ifeq ($(HAVE_LIBGC),1) -else -CPPFLAGS += -I$(PRJDIR)/support -endif -endif CFLAGS = @CFLAGS@ -Wall M_OR_MM = @M_OR_MM@ diff --git a/configure b/configure index fea9739a..1b577790 100755 --- a/configure +++ b/configure @@ -19,8 +19,6 @@ ac_help="$ac_help --disable-mcs51-port: Excludes the Intel mcs51 port" ac_help="$ac_help --disable-avr-port: Excludes the AVR port" -ac_help="$ac_help ---disable-boehm-gc: Excludes sdcc use of libgc." # Initialize some variables set by options. # The variables have the same names as the options, with @@ -538,7 +536,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:542: checking for $ac_word" >&5 +echo "configure:540: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -569,7 +567,7 @@ done echo $ac_n "checking version of the package""... $ac_c" 1>&6 -echo "configure:573: checking version of the package" >&5 +echo "configure:571: checking version of the package" >&5 if test -f .version; then VERSION=`cat .version` elif test -f ../.version; then @@ -611,7 +609,7 @@ sdcc_cv_versionp=$VERSIONP # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:615: checking for $ac_word" >&5 +echo "configure:613: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -641,7 +639,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:645: checking for $ac_word" >&5 +echo "configure:643: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -692,7 +690,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:696: checking for $ac_word" >&5 +echo "configure:694: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -724,7 +722,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:728: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:726: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -735,12 +733,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 739 "configure" +#line 737 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -766,12 +764,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:770: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:768: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:775: checking whether we are using GNU C" >&5 +echo "configure:773: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -780,7 +778,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -799,7 +797,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:803: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:801: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -835,7 +833,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:839: checking for $ac_word" >&5 +echo "configure:837: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -867,7 +865,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:871: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:869: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -878,12 +876,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 882 "configure" +#line 880 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -909,12 +907,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:913: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:911: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:918: checking whether we are using GNU C++" >&5 +echo "configure:916: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -923,7 +921,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:925: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -942,7 +940,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:946: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:944: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -974,7 +972,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:978: checking how to run the C preprocessor" >&5 +echo "configure:976: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -989,13 +987,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1006,13 +1004,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1023,13 +1021,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1084,7 +1082,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1088: checking for a BSD compatible install" >&5 +echo "configure:1086: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1139,7 +1137,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1143: checking for $ac_word" >&5 +echo "configure:1141: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1169,7 +1167,7 @@ fi # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1173: checking for $ac_word" >&5 +echo "configure:1171: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1203,7 +1201,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1207: checking for yywrap in -l$ac_lib" >&5 +echo "configure:1205: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1211,7 +1209,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1247,7 +1245,7 @@ fi # Extract the first word of "bison", so it can be a program name with args. set dummy bison; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1251: checking for $ac_word" >&5 +echo "configure:1249: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1277,7 +1275,7 @@ fi # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1281: checking for $ac_word" >&5 +echo "configure:1279: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1307,7 +1305,7 @@ fi # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1311: checking for $ac_word" >&5 +echo "configure:1309: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1337,7 +1335,7 @@ fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1341: checking for $ac_word" >&5 +echo "configure:1339: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1387,12 +1385,12 @@ cross_compiling=$ac_cv_prog_cc_cross # Checking for header files. # =========================================================================== echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1391: checking for ANSI C header files" >&5 +echo "configure:1389: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1400,7 +1398,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1417,7 +1415,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1435,7 +1433,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1456,7 +1454,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1467,7 +1465,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1494,17 +1492,17 @@ for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1498: checking for $ac_hdr" >&5 +echo "configure:1496: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1506: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1534,17 +1532,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1538: checking for $ac_hdr" >&5 +echo "configure:1536: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1546: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1574,17 +1572,57 @@ for ac_hdr in endian.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1578: checking for $ac_hdr" >&5 +echo "configure:1576: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in malloc.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1616: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1626: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1614,17 +1652,17 @@ for ac_hdr in sys/isa_defs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1618: checking for $ac_hdr" >&5 +echo "configure:1656: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1666: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1654,17 +1692,17 @@ for ac_hdr in sys/socket.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1658: checking for $ac_hdr" >&5 +echo "configure:1696: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1668: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1706: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1695,12 +1733,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1699: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1737: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1708,7 +1746,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1733,7 +1771,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1737: checking for opendir in -ldir" >&5 +echo "configure:1775: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1741,7 +1779,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1774,7 +1812,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1778: checking for opendir in -lx" >&5 +echo "configure:1816: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1782,7 +1820,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1819,13 +1857,13 @@ fi # This must be after CPP echo $ac_n "checking which header file defines FD_ macros""... $ac_c" 1>&6 -echo "configure:1823: checking which header file defines FD_ macros" >&5 +echo "configure:1861: checking which header file defines FD_ macros" >&5 if eval "test \"`echo '$''{'s51_cv_fd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else sdcc_cv_fd="unknown" cat > conftest.$ac_ext < @@ -1841,7 +1879,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < @@ -1857,7 +1895,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < @@ -1937,12 +1975,12 @@ EOF for ac_func in strlen strcpy strcat strstr strcmp strerror strtok strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1941: checking for $ac_func" >&5 +echo "configure:1979: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1992,12 +2030,12 @@ done for ac_func in strchr memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1996: checking for $ac_func" >&5 +echo "configure:2034: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2047,12 +2085,12 @@ done for ac_func in fgets do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2051: checking for $ac_func" >&5 +echo "configure:2089: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2102,12 +2140,12 @@ done for ac_func in yylex do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2106: checking for $ac_func" >&5 +echo "configure:2144: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2158,14 +2196,14 @@ done # check if -lsocket && -lxnet is required to compile socket stuff echo $ac_n "checking for library containing socket""... $ac_c" 1>&6 -echo "configure:2162: checking for library containing socket" >&5 +echo "configure:2200: checking for library containing socket" >&5 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socket="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="none required" else @@ -2187,7 +2225,7 @@ rm -f conftest* test "$ac_cv_search_socket" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="-l$i" break @@ -2220,14 +2258,14 @@ else : fi echo $ac_n "checking for library containing inet_addr""... $ac_c" 1>&6 -echo "configure:2224: checking for library containing inet_addr" >&5 +echo "configure:2262: checking for library containing inet_addr" >&5 if eval "test \"`echo '$''{'ac_cv_search_inet_addr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_inet_addr="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_inet_addr="none required" else @@ -2249,7 +2287,7 @@ rm -f conftest* test "$ac_cv_search_inet_addr" = "no" && for i in nsl xnet; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_inet_addr="-l$i" break @@ -2294,7 +2332,7 @@ fi # Checking characteristics of compilers and other programs # -------------------------------------------------------- echo $ac_n "checking whether preprocessor accepts -MM or -M""... $ac_c" 1>&6 -echo "configure:2298: checking whether preprocessor accepts -MM or -M" >&5 +echo "configure:2336: checking whether preprocessor accepts -MM or -M" >&5 if eval "test \"`echo '$''{'sdcc_cv_MM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2316,7 +2354,7 @@ M_OR_MM=$sdcc_cv_MM # This is the first time when CFLAGS are set/modified!! echo $ac_n "checking whether $CC accepts -ggdb""... $ac_c" 1>&6 -echo "configure:2320: checking whether $CC accepts -ggdb" >&5 +echo "configure:2358: checking whether $CC accepts -ggdb" >&5 if eval "test \"`echo '$''{'sdcc_cv_CCggdb'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2341,7 +2379,7 @@ fi echo $ac_n "checking whether $CC accepts -pipe""... $ac_c" 1>&6 -echo "configure:2345: checking whether $CC accepts -pipe" >&5 +echo "configure:2383: checking whether $CC accepts -pipe" >&5 if eval "test \"`echo '$''{'sdcc_cv_CCpipe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2368,12 +2406,12 @@ fi # Checks for typedefs, structures, and compiler characteristics. # =========================================================================== echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2372: checking return type of signal handlers" >&5 +echo "configure:2410: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2390,7 +2428,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2467,48 +2505,6 @@ cat >> confdefs.h <&6 -echo "configure:2473: checking for GC_malloc in -lgc" >&5 -ac_lib_var=`echo gc'_'GC_malloc | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lgc $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - HAVE_LIBGC=1 -else - echo "$ac_t""no" 1>&6 -fi - - # Now handle the port selection # Check whether --enable-z80-port or --disable-z80-port was given. @@ -2583,27 +2579,6 @@ EOF fi -# Check whether --enable-boehm-gc or --disable-boehm-gc was given. -if test "${enable_boehm_gc+set}" = set; then - enableval="$enable_boehm_gc" - : -fi - - -if test "$enable_boehm_gc" = "no"; then - cat >> confdefs.h <<\EOF -#define OPT_DISABLE_GC 1 -EOF - - DISABLE_GC=1 -else - cat >> confdefs.h <<\EOF -#define OPT_DISABLE_GC 0 -EOF - - DISABLE_GC=0 -fi - # Generating output files # =========================================================================== subdirs="sim/ucsim" @@ -2715,8 +2690,6 @@ ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "main.mk:main_in.mk -support/gc/Makefile -support/gc/Makefile.cross src/Makefile as/mcs51/Makefile support/cpp/Makefile @@ -2775,8 +2748,6 @@ s%@AUTOCONF@%$AUTOCONF%g s%@AS@%$AS%g s%@CP@%$CP%g s%@M_OR_MM@%$M_OR_MM%g -s%@HAVE_LIBGC@%$HAVE_LIBGC%g -s%@DISABLE_GC@%$DISABLE_GC%g s%@subdirs@%$subdirs%g CEOF @@ -2820,8 +2791,6 @@ EOF cat >> $CONFIG_STATUS <addr) == NULL) simClearBP (bp->addr); - GC_free(bp); + free(bp); } } @@ -133,7 +133,7 @@ void deleteNEXTbp () } - GC_free(bp); + free(bp); } } diff --git a/debugger/mcs51/sdcdb.c b/debugger/mcs51/sdcdb.c index 423e37eb..ef85f5bb 100644 --- a/debugger/mcs51/sdcdb.c +++ b/debugger/mcs51/sdcdb.c @@ -183,9 +183,9 @@ void **resize (void **array, int newSize) void **vptr; if (array) - vptr = GC_realloc(array,newSize*(sizeof(void **))); + vptr = realloc(array,newSize*(sizeof(void **))); else - vptr = GC_malloc(sizeof(void **)); + vptr = calloc(1, sizeof(void **)); if (!vptr) { fprintf(stderr,"sdcdb: out of memory \n"); diff --git a/debugger/mcs51/sdcdb.h b/debugger/mcs51/sdcdb.h index 84fe88c7..c3bc3c20 100644 --- a/debugger/mcs51/sdcdb.h +++ b/debugger/mcs51/sdcdb.h @@ -32,7 +32,6 @@ #include #include #include "sdccconf.h" -#include "src/SDCCalloc.h" #include "src/SDCCset.h" #include "src/SDCChasht.h" @@ -50,14 +49,14 @@ typedef short bool; #endif #ifndef ALLOC -#define ALLOC(x,sz) if (!(x = GC_malloc(sz))) \ +#define ALLOC(x,sz) if (!(x = calloc(1, sz))) \ { \ fprintf(stderr,"sdcdb: out of memory\n"); \ exit (1); \ } #endif #ifndef ALLOC_ATOMIC -#define ALLOC_ATOMIC(x,sz) if (!(x = GC_malloc_atomic(sz))) \ +#define ALLOC_ATOMIC(x,sz) if (!(x = calloc(1, sz))) \ { \ fprintf(stderr,"sdcdb: out of memory\n"); \ exit (1); \ diff --git a/sdcc_vc.h b/sdcc_vc.h index 1257a016..0677a76e 100644 --- a/sdcc_vc.h +++ b/sdcc_vc.h @@ -33,8 +33,6 @@ #undef OPT_DISABLE_MCS51 #undef OPT_DISABLE_AVR -#define OPT_DISABLE_GC 1 - #endif /* End of config.h */ diff --git a/sdccconf_in.h b/sdccconf_in.h index d8cebd48..70ca5cfc 100644 --- a/sdccconf_in.h +++ b/sdccconf_in.h @@ -32,7 +32,6 @@ #undef OPT_DISABLE_GBZ80 #undef OPT_DISABLE_MCS51 #undef OPT_DISABLE_AVR -#undef OPT_DISABLE_GC #endif diff --git a/src/Makefile.in b/src/Makefile.in index c4a1a026..a2c567ae 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -11,16 +11,7 @@ USE_ALT_LEX = 0 PORTS = mcs51 z80 avr ds390 pic izt PORT_LIBS = $(PORTS:%=%/port.a) -ifeq ($(DISABLE_GC),1) LIBS = -lm @LIBS@ -else -LIBS = -lgc -lm @LIBS@ -ifeq ($(HAVE_LIBGC), 1) -else -LIBDIRS = -L$(PRJDIR)/support/gc -LIBGC = $(PRJDIR)/support/gc/libgc.a -endif -endif #CFLAGS += -Werror diff --git a/src/SDCC.lex b/src/SDCC.lex index a39f0c4f..edd42cf0 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -262,7 +262,7 @@ int checkCurrFile ( char *s) /* mark the end of the filename */ while (*s != '"') s++; *s = '\0'; - ALLOC_ATOMIC(currFname,strlen(sb)+1); + ALLOC(currFname,strlen(sb)+1); strcpy(currFname,sb); yylineno = lNum - 2; } diff --git a/src/SDCC.y b/src/SDCC.y index 64fc3594..8dd9d97b 100644 --- a/src/SDCC.y +++ b/src/SDCC.y @@ -1113,7 +1113,7 @@ statement | jump_statement | INLINEASM ';' { ast *ex = newNode(INLINEASM,NULL,NULL); - ALLOC_ATOMIC(ex->values.inlineasm,strlen($1)); + ALLOC(ex->values.inlineasm,strlen($1)); strcpy(ex->values.inlineasm,$1); $$ = ex; } diff --git a/src/SDCCBBlock.c b/src/SDCCBBlock.c index 4d40389c..5d975e5f 100644 --- a/src/SDCCBBlock.c +++ b/src/SDCCBBlock.c @@ -400,12 +400,15 @@ eBBlock **iCodeBreakDown (iCode *ic, int *count) /* put it in the array */ ebbs[(*count)++] = ebb ; - /* allocate for the next one */ - if (!(ebbs = GC_realloc(ebbs,(*count + 1)*sizeof(eBBlock **)))) { + /* allocate for the next one. Remember to clear the new */ + /* pointer at the end, that was created by realloc. */ + if (!(ebbs = realloc(ebbs,(*count + 1)*sizeof(eBBlock **)))) { werror(E_OUT_OF_MEM,__FILE__,(*count + 1)*sizeof(eBBlock **)); exit (1); } - + + ebbs[*count] = 0; + /* if this one ends in a goto or a conditional */ /* branch then check if the block it is going */ /* to already exists, if yes then this could */ @@ -442,10 +445,11 @@ eBBlock **iCodeBreakDown (iCode *ic, int *count) (*count)++ ; /* if we have stopped at the block , allocate for an extra one */ - if (!(ebbs = GC_realloc(ebbs,(*count + 1)*sizeof(eBBlock **)))) { + if (!(ebbs = realloc(ebbs,(*count + 1)*sizeof(eBBlock **)))) { werror(E_OUT_OF_MEM,__FILE__,(*count + 1)*sizeof(eBBlock **)); exit (1); } + ebbs[*count] = 0; /* then move the block down one count */ pBlock = ebbs[j = i]; diff --git a/src/SDCCalloc.h b/src/SDCCalloc.h deleted file mode 100644 index c0d71f83..00000000 --- a/src/SDCCalloc.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef _SDCCalloc_H -#define _SDCCalloc_H - -#include "SDCCerr.h" - -#if OPT_DISABLE_GC != 0 - -# include -# define GC_malloc(x) calloc((x), 1) -# define GC_free(x) free(x) -# define GC_realloc realloc -# define GC_malloc_atomic malloc - -#else - -#include "./gc/gc.h" - -#endif - - -#define ALLOC(x,sz) if (!(x = GC_malloc(sz))) \ - { \ - werror(E_OUT_OF_MEM,__FILE__,(long) sz);\ - exit (1); \ - } - -#define ALLOC_ATOMIC(x,sz) if (!(x = GC_malloc_atomic(sz))) \ - { \ - werror(E_OUT_OF_MEM,__FILE__,(long) sz); \ - exit (1); \ - } - - -#endif diff --git a/src/SDCCast.c b/src/SDCCast.c index 347fcace..ff75fff7 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -206,7 +206,7 @@ void copyAstValues (ast *dest,ast *src) break ; case INLINEASM: - ALLOC_ATOMIC(dest->values.inlineasm,strlen(src->values.inlineasm)); + ALLOC(dest->values.inlineasm,strlen(src->values.inlineasm)); strcpy(dest->values.inlineasm,src->values.inlineasm); case FOR: diff --git a/src/SDCCbitv.c b/src/SDCCbitv.c index c75f7389..fe8e1b60 100644 --- a/src/SDCCbitv.c +++ b/src/SDCCbitv.c @@ -65,7 +65,7 @@ bitVect *bitVectResize (bitVect *bvp, int size) bvp->size = size; bvp->bSize= bSize; - bvp->vect = GC_realloc(bvp->vect, bSize); + bvp->vect = realloc(bvp->vect, bSize); return bvp; } diff --git a/src/SDCCglobl.h b/src/SDCCglobl.h index 1c05ec56..96f760db 100644 --- a/src/SDCCglobl.h +++ b/src/SDCCglobl.h @@ -27,8 +27,6 @@ #define NATIVE_WIN32 1 #endif -# include "SDCCalloc.h" - #define SPACE ' ' #define ZERO 0 @@ -90,9 +88,16 @@ typedef int bool; type *type##FreeStack [size] ; \ int type##StackPtr = 0 ; -#define ALLOCTYPE(type,size) if (!(type##Pool = GC_malloc(size*sizeof(type)))) \ +#define ALLOC(x,sz) if (!(x = calloc(1, sz))) \ + { \ + werror(E_OUT_OF_MEM,__FILE__,(long) sz);\ + exit (1); \ + } + + +#define ALLOCTYPE(type,size) if (!(type##Pool = calloc(1, size*sizeof(type))))\ { \ - werror(E_OUT_OF_MEM,__FILE__,(long) size); \ + werror(E_OUT_OF_MEM,__FILE__,(long) size); \ exit (1); \ } diff --git a/src/SDCCglue.c b/src/SDCCglue.c index f07bcb74..3cd5c434 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -121,7 +121,7 @@ char *aopLiteralLong(value *val, int offset, int size) /* Hmm. Too big for now. */ assert(0); } - ALLOC_ATOMIC(rs,strlen(buffer)+1); + ALLOC(rs,strlen(buffer)+1); return strcpy (rs,buffer); } @@ -135,7 +135,7 @@ char *aopLiteralLong(value *val, int offset, int size) #else tsprintf(buffer, "!immedbyte", fl.c[offset]); #endif - ALLOC_ATOMIC(rs,strlen(buffer)+1); + ALLOC(rs,strlen(buffer)+1); return strcpy (rs,buffer); } @@ -1375,7 +1375,7 @@ FILE *tempfile(void) char *gc_strdup(const char *s) { char *ret; - ALLOC_ATOMIC(ret, strlen(s)+1); + ALLOC(ret, strlen(s)+1); strcpy(ret, s); return ret; } diff --git a/src/SDCChasht.c b/src/SDCChasht.c index d083faa3..97033265 100644 --- a/src/SDCChasht.c +++ b/src/SDCChasht.c @@ -56,7 +56,7 @@ hTab *newHashTable (int size) ALLOC(htab,sizeof(hTab)); - if (!(htab->table = GC_malloc((size +1)* sizeof(hashtItem *)))) { + if (!(htab->table = calloc((size +1), sizeof(hashtItem *)))) { fprintf(stderr,"out of virtual memory %s %d\n", __FILE__,(size +1)* sizeof(hashtItem *)); exit(1); @@ -76,8 +76,8 @@ void hTabAddItemLong(hTab **htab, int key, void *pkey, void *item) if (key > (*htab)->size ) { int i; - (*htab)->table = GC_realloc ((*htab)->table, - (key*2 + 2)*sizeof(hashtItem *)); + (*htab)->table = realloc ((*htab)->table, + (key*2 + 2)*sizeof(hashtItem *)); for ( i = (*htab)->size +1; i <= (key*2 + 1); i++ ) (*htab)->table[i] = NULL ; (*htab)->size = key*2 + 1; @@ -174,12 +174,12 @@ void hTabDeleteAll(hTab * p) if (!(jc = p->table[i])) continue; jn = jc->next; while(jc){ - GC_free(jc); + free(jc); if((jc=jn)) jn = jc->next; } p->table[i] = NULL ; } - GC_free(p->table); + free(p->table); } } diff --git a/src/SDCChasht.h b/src/SDCChasht.h index 344cab94..94223688 100644 --- a/src/SDCChasht.h +++ b/src/SDCChasht.h @@ -26,7 +26,6 @@ #ifndef SDCCHASHT_H #define SDCCHASHT_H -#include "SDCCalloc.h" /* hashtable item */ diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 3c53bb8f..299cdafe 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -417,7 +417,7 @@ static void processFile (char *s) /* get rid of the "." */ strtok(buffer,"."); - ALLOC_ATOMIC(srcFileName,strlen(buffer)+1); + ALLOC(srcFileName,strlen(buffer)+1); strcpy(srcFileName,buffer); /* get rid of any path information @@ -430,7 +430,7 @@ static void processFile (char *s) *(fext-1) != '/' && *(fext-1) != ':') fext--; - ALLOC_ATOMIC(moduleName,strlen(fext)+1); + ALLOC(moduleName,strlen(fext)+1); strcpy(moduleName,fext); return ; diff --git a/src/SDCCmem.c b/src/SDCCmem.c index 38304065..3fb5899f 100644 --- a/src/SDCCmem.c +++ b/src/SDCCmem.c @@ -45,7 +45,7 @@ memmap *allocMap (char rspace, /* sfr space */ { memmap *map ; - if (!(map = GC_malloc(sizeof(memmap)))) { + if (!(map = calloc(sizeof(memmap), 1))) { werror(E_OUT_OF_MEM,__FILE__,sizeof(memmap)); exit (1); } diff --git a/src/SDCCpeeph.c b/src/SDCCpeeph.c index b06c6f9e..90762177 100644 --- a/src/SDCCpeeph.c +++ b/src/SDCCpeeph.c @@ -276,7 +276,7 @@ peepRule *newPeepRule (lineNode *match , pr->restart = restart; if (cond && *cond) { - ALLOC_ATOMIC(pr->cond,strlen(cond)+1); + ALLOC(pr->cond,strlen(cond)+1); strcpy(pr->cond,cond); } else pr->cond = NULL ; @@ -300,7 +300,7 @@ lineNode *newLineNode (char *line) lineNode *pl; ALLOC(pl,sizeof(lineNode)); - ALLOC_ATOMIC(pl->line,strlen(line)+1); + ALLOC(pl->line,strlen(line)+1); strcpy(pl->line,line); return pl; } @@ -506,7 +506,7 @@ static void bindVar (int key, char **s, hTab **vtab) *s = vvx ; *vv = '\0'; /* got value */ - ALLOC_ATOMIC(vvx,strlen(vval)+1); + ALLOC(vvx,strlen(vval)+1); strcpy(vvx,vval); hTabAddItem(vtab,key,vvx); @@ -911,10 +911,10 @@ static char *readFileIntoBuffer (char *fname) lb[nch] = '\0'; /* copy it into allocated buffer */ if (rs) { - rs = GC_realloc(rs,strlen(rs)+strlen(lb)+1); + rs = realloc(rs,strlen(rs)+strlen(lb)+1); strcat(rs,lb); } else { - ALLOC_ATOMIC(rs,strlen(lb)+1); + ALLOC(rs,strlen(lb)+1); strcpy(rs,lb); } nch = 0 ; @@ -926,10 +926,10 @@ static char *readFileIntoBuffer (char *fname) lb[nch] = '\0'; /* copy it into allocated buffer */ if (rs) { - rs = GC_realloc(rs,strlen(rs)+strlen(lb)+1); + rs = realloc(rs,strlen(rs)+strlen(lb)+1); strcat(rs,lb); } else { - ALLOC_ATOMIC(rs,strlen(lb)+1); + ALLOC(rs,strlen(lb)+1); strcpy(rs,lb); } } diff --git a/src/SDCCset.c b/src/SDCCset.c index 2b2648bc..f1f039d0 100644 --- a/src/SDCCset.c +++ b/src/SDCCset.c @@ -23,6 +23,7 @@ -------------------------------------------------------------------------*/ #include +#include #include #include "SDCCset.h" @@ -33,7 +34,11 @@ set *newSet () { set *lp ; - ALLOC(lp,sizeof(set)) ; + lp = calloc(1, sizeof(set)); + if (lp == 0) { + fprintf(stderr, "out of virtual memory: %s\n", __FILE__); + exit(1); + } lp->item = lp->curr= lp->next = NULL; return lp; @@ -498,6 +503,6 @@ void setToNull (void **item ) if (! *item ) return ; - GC_free(*item); + free(*item); *item = NULL ; } diff --git a/src/SDCCset.h b/src/SDCCset.h index f60664e7..b5e2ccde 100644 --- a/src/SDCCset.h +++ b/src/SDCCset.h @@ -32,8 +32,6 @@ # include "sdccconf.h" #endif // _MSC_VER -#include "SDCCalloc.h" - #ifndef THROWS #define THROWS diff --git a/src/SDCCval.c b/src/SDCCval.c index 001e1210..644054df 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -402,7 +402,7 @@ value *strVal ( char *s ) SPEC_NOUN(val->etype) = V_CHAR ; SPEC_SCLS(val->etype) = S_LITERAL; - ALLOC_ATOMIC(SPEC_CVAL(val->etype).v_char,strlen(s)+1); + ALLOC(SPEC_CVAL(val->etype).v_char,strlen(s)+1); copyStr (SPEC_CVAL(val->etype).v_char,s); return val; } diff --git a/src/ds390/gen.c b/src/ds390/gen.c index e2db1f70..85cb88d0 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -36,6 +36,7 @@ #include #include "ralloc.h" #include "gen.h" +#include "SDCCglobl.h" #ifdef HAVE_SYS_ISA_DEFS_H #include @@ -460,7 +461,7 @@ static asmop *aopForSym (iCode *ic,symbol *sym,bool result, bool useDP2) /* special case for a function */ if (IS_FUNC(sym->type)) { sym->aop = aop = newAsmop(AOP_IMMD); - ALLOC_ATOMIC(aop->aopu.aop_immd,strlen(sym->rname)+1); + ALLOC(aop->aopu.aop_immd,strlen(sym->rname)+1); strcpy(aop->aopu.aop_immd,sym->rname); aop->size = FPTRSIZE; return aop; @@ -518,7 +519,7 @@ static asmop *aopForRemat (symbol *sym) else strcpy(buffer,OP_SYMBOL(IC_LEFT(ic))->rname); - ALLOC_ATOMIC(aop->aopu.aop_immd,strlen(buffer)+1); + ALLOC(aop->aopu.aop_immd,strlen(buffer)+1); strcpy(aop->aopu.aop_immd,buffer); return aop; } @@ -889,7 +890,7 @@ static char *aopGet (asmop *aop, return (dname ? "acc" : "a"); } sprintf(s,"@%s",aop->aopu.aop_ptr->name); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -955,7 +956,7 @@ static char *aopGet (asmop *aop, else sprintf(s,"#%s", aop->aopu.aop_immd); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -966,7 +967,7 @@ static char *aopGet (asmop *aop, offset); else sprintf(s,"%s",aop->aopu.aop_dir); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 1f940d96..fe68ff17 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -353,7 +353,7 @@ static asmop *aopForSym (iCode *ic,symbol *sym,bool result) /* special case for a function */ if (IS_FUNC(sym->type)) { sym->aop = aop = newAsmop(AOP_IMMD); - ALLOC_ATOMIC(aop->aopu.aop_immd,strlen(sym->rname)+1); + ALLOC(aop->aopu.aop_immd,strlen(sym->rname)+1); strcpy(aop->aopu.aop_immd,sym->rname); aop->size = FPTRSIZE; return aop; @@ -400,7 +400,7 @@ static asmop *aopForRemat (symbol *sym) else strcpy(buffer,OP_SYMBOL(IC_LEFT(ic))->rname); - ALLOC_ATOMIC(aop->aopu.aop_immd,strlen(buffer)+1); + ALLOC(aop->aopu.aop_immd,strlen(buffer)+1); strcpy(aop->aopu.aop_immd,buffer); return aop; } @@ -747,7 +747,7 @@ static char *aopGet (asmop *aop, int offset, bool bit16, bool dname) return (dname ? "acc" : "a"); } sprintf(s,"@%s",aop->aopu.aop_ptr->name); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -797,7 +797,7 @@ static char *aopGet (asmop *aop, int offset, bool bit16, bool dname) else sprintf(s,"#%s", aop->aopu.aop_immd); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -808,7 +808,7 @@ static char *aopGet (asmop *aop, int offset, bool bit16, bool dname) offset); else sprintf(s,"%s",aop->aopu.aop_dir); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; diff --git a/src/z80/gen.c b/src/z80/gen.c index 6ff3ebe8..1d95fc8a 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -55,6 +55,7 @@ #endif #include "z80.h" +#include "SDCCglobl.h" #include "SDCCpeeph.h" #include "gen.h" #include "SDCCglue.h" @@ -368,7 +369,7 @@ static asmop *aopForSym (iCode *ic,symbol *sym,bool result, bool requires_a) /* special case for a function */ if (IS_FUNC(sym->type)) { sym->aop = aop = newAsmop(AOP_IMMD); - ALLOC_ATOMIC(aop->aopu.aop_immd,strlen(sym->rname)+1); + ALLOC(aop->aopu.aop_immd,strlen(sym->rname)+1); strcpy(aop->aopu.aop_immd,sym->rname); aop->size = 2; return aop; @@ -428,7 +429,7 @@ static asmop *aopForRemat (symbol *sym) break; } - ALLOC_ATOMIC(aop->aopu.aop_immd,strlen(buffer)+1); + ALLOC(aop->aopu.aop_immd,strlen(buffer)+1); strcpy(aop->aopu.aop_immd,buffer); return aop; } @@ -715,7 +716,7 @@ char *aopGetLitWordLong(asmop *aop, int offset, bool with_hash) tsprintf(s, "!hashedstr + %d", aop->aopu.aop_immd, offset); else tsprintf(s, "%s + %d", aop->aopu.aop_immd, offset); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; case AOP_LIT: { @@ -732,7 +733,7 @@ char *aopGetLitWordLong(asmop *aop, int offset, bool with_hash) tsprintf(buffer, "!immedword", v); else tsprintf(buffer, "!constword", v); - ALLOC_ATOMIC(rs,strlen(buffer)+1); + ALLOC(rs,strlen(buffer)+1); return strcpy (rs,buffer); } else { @@ -743,7 +744,7 @@ char *aopGetLitWordLong(asmop *aop, int offset, bool with_hash) tsprintf(buffer, "!immedword", f.w[offset/2]); else tsprintf(buffer, "!constword", f.w[offset/2]); - ALLOC_ATOMIC(rs,strlen(buffer)+1); + ALLOC(rs,strlen(buffer)+1); return strcpy (rs,buffer); } } @@ -993,7 +994,7 @@ static char *aopGet(asmop *aop, int offset, bool bit16) default: wassert(0); } - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -1001,7 +1002,7 @@ static char *aopGet(asmop *aop, int offset, bool bit16) wassert(IS_GB); emitcode("ld", "a,(%s+%d) ; x", aop->aopu.aop_dir, offset); sprintf(s, "a"); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -1009,7 +1010,7 @@ static char *aopGet(asmop *aop, int offset, bool bit16) wassert(IS_GB); emitcode("ldh", "a,(%s+%d) ; x", aop->aopu.aop_dir, offset); sprintf(s, "a"); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -1026,7 +1027,7 @@ static char *aopGet(asmop *aop, int offset, bool bit16) wassert(IS_Z80); setupPair(PAIR_IY, aop, offset); tsprintf(s,"!*iyx", offset); - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; @@ -1040,7 +1041,7 @@ static char *aopGet(asmop *aop, int offset, bool bit16) offset += _G.stack.param_offset; tsprintf(s,"!*ixx ; x", aop->aopu.aop_stk+offset); } - ALLOC_ATOMIC(rs,strlen(s)+1); + ALLOC(rs,strlen(s)+1); strcpy(rs,s); return rs; diff --git a/support/cpp/cppalloc.c b/support/cpp/cppalloc.c index 8e06b98d..4af9bd94 100644 --- a/support/cpp/cppalloc.c +++ b/support/cpp/cppalloc.c @@ -23,6 +23,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. what you give them. Help stamp out software-hoarding! */ #include "config.h" +#ifdef HAVE_MALLOC_H +#include +#endif static void memory_full () -- 2.47.2