1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-23 07:12:12 -07:00

Improve control over checking:

1. Where Type is a pointer type with a signature, replace CHECKL(TypeCheck(val)) with CHECKD(Type, val).
2. Where Type is a pointer type with no signature, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val).
3. Where Type is a pointer type with a signature, but the structure is not visible at point of checking, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val). Reference <design/check/#.hidden-type>
4. Make BTCheck extern and use it where possible.
5. Replace AVER(TypeCheck(val)) with AVERT(Type, val).

Copied from Perforce
 Change: 185263
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-04-06 22:51:05 +01:00
parent f970e9d82c
commit bcea6812fc
46 changed files with 287 additions and 278 deletions

View file

@ -45,7 +45,7 @@ Bool BufferCheck(Buffer buffer)
CHECKU(Arena, buffer->arena);
CHECKU(Pool, buffer->pool);
CHECKL(buffer->arena == buffer->pool->arena);
CHECKL(RingCheck(&buffer->poolRing)); /* <design/check/#type.no-sig> */
CHECKD_NOSIG(Ring, &buffer->poolRing);
CHECKL(BoolCheck(buffer->isMutator));
CHECKL(buffer->fillSize >= 0.0);
CHECKL(buffer->emptySize >= 0.0);
@ -605,7 +605,7 @@ Res BufferReserve(Addr *pReturn, Buffer buffer, Size size,
AVER(size > 0);
AVER(SizeIsAligned(size, BufferPool(buffer)->alignment));
AVER(BufferIsReady(buffer));
AVER(BoolCheck(withReservoirPermit));
AVERT(Bool, withReservoirPermit);
/* Is there enough room in the unallocated portion of the buffer to */
/* satisfy the request? If so, just increase the alloc marker and */
@ -1182,7 +1182,7 @@ static Res bufferTrivDescribe(Buffer buffer, mps_lib_FILE *stream)
Bool BufferClassCheck(BufferClass class)
{
CHECKL(ProtocolClassCheck(&class->protocol));
CHECKD(ProtocolClass, &class->protocol);
CHECKL(class->name != NULL); /* Should be <=6 char C identifier */
CHECKL(class->size >= sizeof(BufferStruct));
CHECKL(FUNCHECK(class->varargs));
@ -1241,7 +1241,7 @@ Bool SegBufCheck(SegBuf segbuf)
CHECKS(SegBuf, segbuf);
buffer = &segbuf->bufferStruct;
CHECKL(BufferCheck(buffer));
CHECKD(Buffer, buffer);
CHECKL(RankSetCheck(segbuf->rankSet));
if (buffer->mode & BufferModeTRANSITION) {
@ -1251,7 +1251,7 @@ Bool SegBufCheck(SegBuf segbuf)
} else {
/* The buffer is attached to a segment. */
CHECKL(segbuf->seg != NULL);
CHECKL(SegCheck(segbuf->seg));
CHECKD(Seg, segbuf->seg);
/* To avoid recursive checking, leave it to SegCheck to make */
/* sure the buffer and segment fields tally. */
@ -1487,7 +1487,7 @@ static void rankBufVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs)
args[0].key = MPS_KEY_RANK;
args[0].val.rank = va_arg(varargs, Rank);
args[1].key = MPS_KEY_ARGS_END;
AVER(ArgListCheck(args));
AVERT(ArgList, args);
}
/* rankBufInit -- RankBufClass init method */
@ -1501,10 +1501,10 @@ static Res rankBufInit(Buffer buffer, Pool pool, ArgList args)
AVERT(Buffer, buffer);
AVERT(Pool, pool);
AVER(ArgListCheck(args));
AVERT(ArgList, args);
if (ArgPick(&arg, args, MPS_KEY_RANK))
rank = arg.val.rank;
AVER(RankCheck(rank));
AVERT(Rank, rank);
/* Initialize the superclass fields first via next-method call */
super = BUFFER_SUPERCLASS(RankBufClass);