From 93288b1b6b66e279ff92700ad78627879c3e3531 Mon Sep 17 00:00:00 2001 From: das Date: Tue, 30 Jun 2009 00:56:08 +0000 Subject: * generic/tclInt.h: add assert macros for clang static * generic/tclPanic.c: analyzer and redefine Tcl_Panic to * generic/tclStubInit.c: assert after panic in clang PURIFY builds. * generic/tclCmdIL.c: add clang assert for false positive from static analyzer. --- ChangeLog | 10 ++++++++++ generic/tclCmdIL.c | 3 ++- generic/tclInt.h | 16 +++++++++++++++- generic/tclPanic.c | 3 ++- generic/tclStubInit.c | 3 ++- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4717abd..79a0301 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-06-30 Daniel Steffen + + * generic/tclInt.h: add assert macros for clang static + * generic/tclPanic.c: analyzer and redefine Tcl_Panic to + * generic/tclStubInit.c: assert after panic in clang PURIFY + builds. + + * generic/tclCmdIL.c: add clang assert for false positive + from static analyzer. + 2009-06-26 Daniel Steffen * macosx/Tcl-Common.xcconfig: update projects for Xcode 3.1 and 3.2, diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index be62444..e86f686 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.165 2009/02/03 23:34:32 nijtmans Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.166 2009/06/30 00:56:08 das Exp $ */ #include "tclInt.h" @@ -2508,6 +2508,7 @@ Tcl_LrepeatObjCmd( * number of times. */ + CLANG_ASSERT(dataArray); if (objc == 1) { register Tcl_Obj *tmpPtr = objv[0]; diff --git a/generic/tclInt.h b/generic/tclInt.h index d75eaa6..80aec34 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.424 2009/06/18 09:41:27 dkf Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.425 2009/06/30 00:56:08 das Exp $ */ #ifndef _TCLINT @@ -4186,6 +4186,20 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, #endif /* TCL_MEM_DEBUG */ /* + * Macros for clang static analyzer + */ + +#if defined(PURIFY) && defined(__clang__) && !defined(CLANG_ASSERT) +#include +#define CLANG_ASSERT(x) assert(x) +#define Tcl_PanicEx Tcl_Panic +#undef Tcl_Panic +#define Tcl_Panic(f, ...) Tcl_PanicEx(f,##__VA_ARGS__); CLANG_ASSERT(0) +#elif !defined(CLANG_ASSERT) +#define CLANG_ASSERT(x) +#endif + +/* *---------------------------------------------------------------- * Parameters, structs and macros for the non-recursive engine (NRE) *---------------------------------------------------------------- diff --git a/generic/tclPanic.c b/generic/tclPanic.c index 0a63076..e74df68 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -12,10 +12,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPanic.c,v 1.12 2008/10/26 18:34:04 dkf Exp $ + * RCS: @(#) $Id: tclPanic.c,v 1.13 2009/06/30 00:56:08 das Exp $ */ #include "tclInt.h" +#undef Tcl_Panic /* * The panicProc variable contains a pointer to an application specific panic diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a5a627d..9241677 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStubInit.c,v 1.181 2009/06/18 09:42:40 dkf Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.182 2009/06/30 00:56:08 das Exp $ */ #include "tclInt.h" @@ -33,6 +33,7 @@ #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry #undef Tcl_CreateHashEntry +#undef Tcl_Panic /* * WARNING: The contents of this file is automatically generated by the -- cgit v0.12