1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Add -wconversion to the options for gcc. ensure that the mps builds.

Copied from Perforce
 Change: 185463
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-04-11 14:25:15 +01:00
parent 3a36920e40
commit 93a79ac8a6
15 changed files with 47 additions and 31 deletions

View file

@ -1075,7 +1075,7 @@ static Res bufferTrivInit(Buffer buffer, Pool pool, ArgList args)
AVERT(Buffer, buffer);
AVERT(Pool, pool);
UNUSED(args);
EVENT3(BufferInit, buffer, pool, buffer->isMutator);
EVENT3(BufferInit, buffer, pool, BOOL(buffer->isMutator));
return ResOK;
}
@ -1288,7 +1288,7 @@ static Res segBufInit(Buffer buffer, Pool pool, ArgList args)
segbuf->rankSet = RankSetEMPTY;
AVERT(SegBuf, segbuf);
EVENT3(BufferInitSeg, buffer, pool, buffer->isMutator);
EVENT3(BufferInitSeg, buffer, pool, BOOL(buffer->isMutator));
return ResOK;
}
@ -1515,7 +1515,7 @@ static Res rankBufInit(Buffer buffer, Pool pool, ArgList args)
BufferSetRankSet(buffer, RankSetSingle(rank));
/* There's nothing to check that the superclass doesn't, so no AVERT. */
EVENT4(BufferInitRank, buffer, pool, buffer->isMutator, rank);
EVENT4(BufferInitRank, buffer, pool, BOOL(buffer->isMutator), rank);
return ResOK;
}

View file

@ -1,6 +1,6 @@
/* <code/eventcom.h> -- Event Logging Common Definitions
*
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
* $Id$
*
* .sources: mps.design.telemetry
@ -89,7 +89,11 @@ typedef Word EventFW; /* word */
typedef unsigned EventFU; /* unsigned integer */
typedef char EventFS[EventStringLengthMAX + sizeof('\0')]; /* string */
typedef double EventFD; /* double */
typedef int EventFB; /* boolean */
/* EventFB must be unsigned (even though Bool is a typedef for int)
* because it used as the type of a bitfield with width 1, and we need
* the legals values of the field to be 0 and 1 (not 0 and -1 which
* would be the case for int : 1). */
typedef unsigned EventFB; /* Boolean */
/* Event packing bitfield specifiers */
#define EventFP_BITFIELD
@ -133,7 +137,7 @@ typedef union EventUnion {
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -560,7 +560,7 @@ extern int main(int argc, char *argv[])
Align align;
testlib_init(argc, argv);
align = (1 << rnd() % 4) * MPS_PF_ALIGN;
align = sizeof(void *) << (rnd() % 4);
NAllocateTried = NAllocateSucceeded = NDeallocateTried =
NDeallocateSucceeded = 0;

View file

@ -171,7 +171,7 @@ int main(int argc, char *argv[])
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
"mps_arena_create");
alignment = (1 << (rnd() % 4)) * MPS_PF_ALIGN;
alignment = sizeof(void *) << (rnd() % 4);
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, (64 + rnd() % 64) * 1024);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, (1 + rnd() % 8) * 8);
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
"mps_arena_create");
alignment = (1 << (rnd() % 4)) * MPS_PF_ALIGN;
alignment = sizeof(void *) << (rnd() % 4);
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ALIGN, alignment);
MPS_ARGS_ADD(args, MPS_KEY_MIN_SIZE, (1 + rnd() % 4) * 4);

View file

@ -16,6 +16,7 @@ CFLAGSCOMPILER := \
-Waggregate-return \
-Wall \
-Wcast-qual \
-Wconversion \
-Werror \
-Wextra \
-Winline \

View file

@ -1131,7 +1131,7 @@ void ArenaSetEmergency(Arena arena, Bool emergency)
AVERT(Arena, arena);
AVERT(Bool, emergency);
EVENT2(ArenaSetEmergency, arena, emergency);
EVENT2(ArenaSetEmergency, arena, BOOL(emergency));
arena->emergency = emergency;
}

View file

@ -1,7 +1,7 @@
/* misc.h: MISCELLANEOUS DEFINITIONS
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2001 Global Graphics Software.
*
* Small general things which are useful for C but aren't part of the
@ -170,6 +170,16 @@ typedef const struct SrcIdStruct {
((type *)(void *)((char *)(p) - offsetof(type, field)))
/* BITFIELD -- coerce a value into a bitfield
*
* This coerces value to the given width and type in a way that avoids
* warnings from gcc -Wconversion about possible loss of data.
*/
#define BITFIELD(type, value, width) ((type)value & (((type)1 << (width)) - 1))
#define BOOL(v) BITFIELD(unsigned, (v), 1)
/* Bit Sets -- sets of integers in [0,N-1].
*
* Can be used on any unsigned integral type, ty. These definitions
@ -191,6 +201,7 @@ typedef const struct SrcIdStruct {
#define BS_SUB(s1, s2) BS_SUPER((s2), (s1))
#define BS_IS_SINGLE(s) ( ((s) != 0) && (((s) & ((s)-1)) == 0) )
#define BS_SYM_DIFF(s1, s2) ((s1) ^ (s2))
#define BS_BITFIELD(ty, s) BITFIELD(ty ## Set, (s), ty ## LIMIT)
#endif /* misc_h */
@ -198,7 +209,7 @@ typedef const struct SrcIdStruct {
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -711,10 +711,10 @@ extern Addr (SegLimit)(Seg seg);
#define SegSummary(seg) (((GCSeg)(seg))->summary)
#define SegSetPM(seg, mode) ((void)((seg)->pm = (mode)))
#define SegSetSM(seg, mode) ((void)((seg)->sm = (mode)))
#define SegSetDepth(seg, d) ((void)((seg)->depth = (d)))
#define SegSetNailed(seg, ts) ((void)((seg)->nailed = (ts)))
#define SegSetPM(seg, mode) ((void)((seg)->pm = BS_BITFIELD(Access, (mode))))
#define SegSetSM(seg, mode) ((void)((seg)->sm = BS_BITFIELD(Access, (mode))))
#define SegSetDepth(seg, d) ((void)((seg)->depth = BITFIELD(unsigned, (d), ShieldDepthWIDTH)))
#define SegSetNailed(seg, ts) ((void)((seg)->nailed = BS_BITFIELD(Trace, (ts))))
/* Buffer Interface -- see <code/buffer.c> */

View file

@ -1,7 +1,7 @@
/* mpmst.h: MEMORY POOL MANAGER DATA STRUCTURES
*
* $Id$
* Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2001 Global Graphics Software.
*
* .design: This header file crosses module boundaries. The relevant
@ -275,8 +275,8 @@ typedef struct SegStruct { /* segment structure */
RingStruct poolRing; /* link in list of segs in pool */
Addr limit; /* limit of segment */
unsigned depth : ShieldDepthWIDTH; /* see <code/shield.c#def.depth> */
AccessSet pm : AccessSetWIDTH; /* protection mode, <code/shield.c> */
AccessSet sm : AccessSetWIDTH; /* shield mode, <code/shield.c> */
AccessSet pm : AccessLIMIT; /* protection mode, <code/shield.c> */
AccessSet sm : AccessLIMIT; /* shield mode, <code/shield.c> */
TraceSet grey : TraceLIMIT; /* traces for which seg is grey */
TraceSet white : TraceLIMIT; /* traces for which seg is white */
TraceSet nailed : TraceLIMIT; /* traces for which seg has nailed objects */
@ -738,7 +738,7 @@ typedef struct AllocPatternStruct {
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -271,7 +271,7 @@ typedef struct TraceMessageStruct *TraceMessage; /* trace end */
#define AccessSetEMPTY ((AccessSet)0) /* <design/type/#access-set> */
#define AccessREAD ((AccessSet)(1<<0))
#define AccessWRITE ((AccessSet)(1<<1))
#define AccessSetWIDTH (2)
#define AccessLIMIT (2)
#define RefSetEMPTY BS_EMPTY(RefSet)
#define RefSetUNIV BS_UNIV(RefSet)
#define ZoneSetEMPTY BS_EMPTY(ZoneSet)

View file

@ -45,7 +45,7 @@ static Count nailboardNails(Nailboard board)
static Count nailboardLevelBits(Count nails, Index level)
{
Shift shift = (Shift)(level * LEVEL_SHIFT);
return (nails + (1 << shift) - 1) >> shift;
return (nails + ((Count)1 << shift) - 1) >> shift;
}
Bool NailboardCheck(Nailboard board)

View file

@ -136,7 +136,7 @@ static Res MFSInit(Pool pool, ArgList args)
mfs->sig = MFSSig;
AVERT(MFS, mfs);
EVENT5(PoolInitMFS, pool, arena, extendBy, extendSelf, unitSize);
EVENT5(PoolInitMFS, pool, arena, extendBy, BOOL(extendSelf), unitSize);
return ResOK;
}

View file

@ -610,7 +610,7 @@ static Res MVFFInit(Pool pool, ArgList args)
mvff->sig = MVFFSig;
AVERT(MVFF, mvff);
EVENT8(PoolInitMVFF, pool, arena, extendBy, avgSize, align,
slotHigh, arenaHigh, firstFit);
BOOL(slotHigh), BOOL(arenaHigh), BOOL(firstFit));
return ResOK;
failInit:

View file

@ -593,7 +593,7 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
if (ResOK != res)
goto failMerge;
EVENT3(SegMerge, segLo, segHi, withReservoirPermit);
EVENT3(SegMerge, segLo, segHi, BOOL(withReservoirPermit));
/* Deallocate segHi object */
ControlFree(arena, segHi, class->size);
AVERT(Seg, segLo);
@ -1200,7 +1200,7 @@ static void gcSegSetGreyInternal(Seg seg, TraceSet oldGrey, TraceSet grey)
/* Internal method. Parameters are checked by caller */
gcseg = SegGCSeg(seg);
arena = PoolArena(SegPool(seg));
seg->grey = grey;
seg->grey = BS_BITFIELD(Trace, grey);
/* If the segment is now grey and wasn't before, add it to the */
/* appropriate grey list so that TraceFindGrey can locate it */
@ -1313,11 +1313,11 @@ static void gcSegSetWhite(Seg seg, TraceSet white)
AVERT_CRITICAL(Tract, tract);
AVER_CRITICAL(TRACT_SEG(&trseg, tract) && (trseg == seg));
TractSetWhite(tract, white);
TractSetWhite(tract, BS_BITFIELD(Trace, white));
}
AVER(addr == limit);
seg->white = white;
seg->white = BS_BITFIELD(Trace, white);
}
@ -1350,7 +1350,7 @@ static void gcSegSetRankSet(Seg seg, RankSet rankSet)
arena = PoolArena(SegPool(seg));
oldRankSet = seg->rankSet;
seg->rankSet = rankSet;
seg->rankSet = BS_BITFIELD(Rank, rankSet);
if (oldRankSet == RankSetEMPTY) {
if (rankSet != RankSetEMPTY) {
@ -1427,7 +1427,7 @@ static void gcSegSetRankSummary(Seg seg, RankSet rankSet, RefSet summary)
wasShielded = (seg->rankSet != RankSetEMPTY && gcseg->summary != RefSetUNIV);
willbeShielded = (rankSet != RankSetEMPTY && summary != RefSetUNIV);
seg->rankSet = rankSet;
seg->rankSet = BS_BITFIELD(Rank, rankSet);
gcseg->summary = summary;
if (willbeShielded && !wasShielded) {

View file

@ -1570,7 +1570,7 @@ static void TraceStartPoolGen(Chain chain, GenDesc desc, Bool top, Index i)
Ring n, nn;
RING_FOR(n, &desc->locusRing, nn) {
PoolGen gen = RING_ELT(PoolGen, genRing, n);
EVENT11(TraceStartPoolGen, chain, top, i, desc,
EVENT11(TraceStartPoolGen, chain, BOOL(top), i, desc,
desc->capacity, desc->mortality, desc->zones,
gen->pool, gen->nr, gen->totalSize,
gen->newSizeAtCreate);