netcdf-c/debug/oc2/Make0
Dennis Heimbigner 245961de00 re: github issues
https://github.com/Unidata/netcdf-c/issues/1168
    https://github.com/Unidata/netcdf-c/issues/1163
    https://github.com/Unidata/netcdf-c/issues/1162

This PR partially fixes memory leaks in the netcdf-c library,
in the ncdump utility, and in some test cases.

The netcdf-c library now runs memory clean with the assumption
that the --disable-utilities option is used. The primary remaining
problem is ncgen. Once that is fixed, I believe the netcdf-c library
will run memory clean with no limitations.

Notes
-----------
1. Memory checking was performed using gcc -fsanitize=address.
   Valgrind-based testing has yet to be performed.
2. The pnetcdf, hdf4, and examples code has not been tested.

Misc. Non-leak changes
1. Make tst_diskless2 only run when netcdf4 is enabled (issue 1162)
2. Fix CmakeLists.txt to turn off logging if ENABLE_NETCDF_4 is OFF
3. Isolated all my debug scripts into a single top-level directory
   called debug
4. Fix some USE_NETCDF4 dependencies in nc_test and nc_test4 Makefile.am
2018-10-30 20:48:12 -06:00

104 lines
2.8 KiB
Plaintext

# OCDIR is assumed to have been set
TST=`if test "x$OCDIR" = x ; then echo "OCDIR not defined"; exit 1 fi`
TST=`echo "OCDIR=$OCDIR"`
THISDIR=../oc2
# Make consistent with Makefile.am
SRC=oc.c \
daplex.c dapparse.c dapy.c \
occlientparams.c occompile.c occurlfunctions.c \
ocdata.c ocdebug.c ocdump.c \
ocinternal.c ocnode.c \
ochttp.c \
ocrc.c ocread.c ocutil.c \
ocbytes.c oclist.c ocuri.c oclog.c \
occurlflags.c \
xxdr.c
HDRS=oc.h ocx.h \
dapparselex.h dapy.h \
occlientparams.h occompile.h occonstraints.h occurlfunctions.h \
ocdata.h ocdatatypes.h ocdebug.h ocdump.h \
ocinternal.h ocnode.h \
ochttp.h ocread.h ocutil.h \
ocbytes.h oclist.h ocuri.h oclog.h \
xxdr.h
DOCS=docs/auth.html.in docs/oc.css
MISC=dap.y
FILES=${HDRS} ${SRC} ${MISC} ${DOCS}
all::
makeoc::
rm -f ${THISDIR}/*.[chy]
for file in ${FILES} ; do \
echo "${OCDIR}/$$file" ; \
f="${OCDIR}/$$file" ; \
base=`basename $$f` ; \
cat $$f | tr -d '
' >${THISDIR}/$$base; \
done
rm -f ocdebug.h XGetopt.[ch]
sed -e 's|^[#]if 1|#if 0|g' \
< ${OCDIR}/ocdebug.h | tr -d '\r' >./ocdebug.h
# This should match the bison command in Makefile.am
rm -f dap.tab.c dap.tab.h
bison --debug -d -p dap dap.y
mv dap.tab.c dapy.c; mv dap.tab.h dapy.h
changed:
${MAKE} -f Make0 NAMEONLY=1 diffoc
diffoc::
@if ! test -e ${OCDIR} ; then echo "${OCDIR} not found"; exit ; fi
@for file in ${FILES} ; do \
f="${OCDIR}/$$file" ; \
x=`basename $$f|tr -d '
' ` ; \
if test "x$${x}" = "xdapy.c" -o "x$${x}" = "xdapy.h" ; then echo "ignore: $${x}"; continue; fi ;\
if ! test -e ${THISDIR}/$$x ; then \
echo "Missing file: $$x"; \
fi ; \
if test -e ${THISDIR}/$$x -a -e ${OCDIR}/$$x ; then \
if ! diff --brief -wBb ${THISDIR}/$$x $$f > /dev/null ; then \
if test "x${NAMEONLY}" = x1 ; then \
echo "$$x" ;\
else \
echo diff -wBb ${THISDIR}/$$x $$f ;\
diff -w ${THISDIR}/$$x $$f ; \
fi; \
fi; \
fi; \
done
olddiff::
if ! test -e ${OCDIR} ; then echo "${OCDIR} not found"; exit ; fi
for file in ${FILES} ; do \
f="${OCDIR}/$$file" ; \
x=`basename $$f | tr -d '
' ` ; \
if test "x$${x}" = "xdapy.c" -o "x$${x}" = "xdapy.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test -e ${THISDIR}/$$x -a -e ${OCDIR}/$$x ; then \
diff --brief -wBb ${THISDIR}/$$x $$f ; \
else \
echo "Only in ${OCDIR}: $$x"; \
fi; \
done
for file in ${FILES} ; do \
f="${OCDIR}/$$file" ; \
x=`basename $$f|tr -d '
' ` ; \
if test "x$${x}" = "xdapy.c" -o "x$${x}" = "xdapy.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test -e ${THISDIR}/$$x -a -e ${OCDIR}/$$x ; then \
if ! diff --brief -wBb ${THISDIR}/$$x $$f > /dev/null ; then \
echo diff -wBb ${THISDIR}/$$x $$f ;\
diff -w ${THISDIR}/$$x $$f ; \
fi; \
fi; \
done
backoc::
for f in ${FILES} ; do \
cp -f ./$$f ${OCDIR}/$$f ; \
done