Bug 886128 - Fix various clang warnings and some potential bugs in nonstandard configurations. r=nnethercote,terrence.

--HG--
extra : rebase_source : 0d833ecc9879f5d9fd0a28f9b4eca7793d01aa40
This commit is contained in:
Emanuel Hoogeveen 2013-06-24 21:32:05 -07:00
parent 694f519ab3
commit ea1eb05d97
19 changed files with 54 additions and 32 deletions

View File

@ -21,6 +21,10 @@
#include "jscntxtinlines.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
using namespace js;
using mozilla::ArrayLength;

View File

@ -12,7 +12,7 @@ struct JSContext;
namespace js {
namespace frontend {
struct ParseNode;
class ParseNode;
bool
NameFunctions(JSContext *cx, ParseNode *pn);

View File

@ -416,9 +416,8 @@ class ConditionalExpression;
class PropertyAccess;
class ModuleBox;
struct ParseNode
class ParseNode
{
private:
uint32_t pn_type : 16, /* PNK_* type */
pn_op : 8, /* see JSOp enum and jsopcode.tbl */
pn_arity : 5, /* see ParseNodeArity enum */

View File

@ -258,8 +258,9 @@ enum VarContext { HoistVars, DontHoistVars };
enum FunctionType { Getter, Setter, Normal };
template <typename ParseHandler>
struct Parser : private AutoGCRooter, public StrictModeGetter
class Parser : private AutoGCRooter, public StrictModeGetter
{
public:
JSContext *const context; /* FIXME Bug 551291: use AutoGCRooter::context? */
TokenStream tokenStream;
LifoAlloc::Mark tempPoolMark;

View File

@ -22,7 +22,7 @@ namespace gc {
*/
class RelocationOverlay
{
friend struct MinorCollectionTracer;
friend class MinorCollectionTracer;
/* The low bit is set so this should never equal a normal pointer. */
const static uintptr_t Relocated = uintptr_t(0xbad0bad1);

View File

@ -48,7 +48,7 @@ js::Nursery::init()
// were marked as uncommitted, but it's a little complicated to avoid
// clobbering pre-existing unrelated mappings.
while (IsPoisonedPtr(heap) || IsPoisonedPtr((void*)(uintptr_t(heap) + NurserySize)))
heap = MapAlignedPages(NurserySize, Alignment);
heap = MapAlignedPages(runtime(), NurserySize, Alignment);
#endif
if (!heap)
return false;
@ -58,7 +58,9 @@ js::Nursery::init()
rt->gcNurseryEnd_ = chunk(LastNurseryChunk).end();
numActiveChunks_ = 1;
setCurrentChunk(0);
#ifdef DEBUG
JS_POISON(heap, FreshNursery, NurserySize);
#endif
for (int i = 0; i < NumNurseryChunks; ++i)
chunk(i).runtime = rt;
@ -108,7 +110,9 @@ js::Nursery::allocate(size_t size)
void *thing = (void *)position();
position_ = position() + size;
#ifdef DEBUG
JS_POISON(thing, AllocatedThing, size);
#endif
return thing;
}

View File

@ -6,11 +6,13 @@
#ifdef JSGC_GENERATIONAL
#include "jsgc.h"
#include "gc/StoreBuffer.h"
#include "mozilla/Assertions.h"
#include "vm/ForkJoin.h"
#include "gc/Barrier-inl.h"
#include "gc/StoreBuffer.h"
#include "vm/ForkJoin.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
@ -64,8 +66,12 @@ StoreBuffer::WholeCellEdges::mark(JSTracer *trc)
MarkChildren(trc, static_cast<JSObject *>(tenured));
return;
}
#ifdef JS_ION
JS_ASSERT(kind == JSTRACE_IONCODE);
static_cast<ion::IonCode *>(tenured)->trace(trc);
#else
MOZ_NOT_REACHED("Only objects can be in the wholeCellBuffer if IonMonkey is disabled.");
#endif
}
/*** MonoTypeBuffer ***/

View File

@ -13,10 +13,12 @@
# error "Generational GC requires exact rooting."
#endif
#include "jsgc.h"
#include "jsalloc.h"
#include "jsgc.h"
#include "jsobj.h"
#include "gc/Nursery.h"
namespace js {
namespace gc {

View File

@ -17,7 +17,7 @@ namespace js {
class ScriptSource;
class SPSProfiler;
class AsmJSModule;
namespace frontend { struct TokenStream; struct ParseNode; }
namespace frontend { class TokenStream; class ParseNode; }
namespace ion { class MIRGenerator; class LIRGraph; }
// Called after parsing a function 'fn' which contains the "use asm" directive.

View File

@ -24,7 +24,7 @@ namespace js {
namespace ion {
class StackValue;
struct ICEntry;
class ICEntry;
class ICStub;
class PCMappingSlotInfo

View File

@ -66,7 +66,7 @@ typedef Vector<IonBuilder*, 0, SystemAllocPolicy> OffThreadCompilationVector;
// Optimized stubs are allocated per-compartment and are always purged when
// JIT-code is discarded. Fallback stubs are allocated per BaselineScript and
// are only destroyed when the BaselineScript is destroyed.
struct ICStubSpace
class ICStubSpace
{
protected:
LifoAlloc allocator_;

View File

@ -8,6 +8,10 @@
#include "jscntxtinlines.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
using namespace js;
struct VersionFixture;

View File

@ -7,7 +7,7 @@
/*
* JS atom table.
*/
#include "jsatom.h"
#include "jsatominlines.h"
#include "mozilla/RangedPtr.h"
#include "mozilla/Util.h"
@ -22,9 +22,11 @@
#include "gc/Marking.h"
#include "vm/Xdr.h"
#include "jsatominlines.h"
#include "jscompartmentinlines.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
#include "vm/String-inl.h"
using namespace js;

View File

@ -25,11 +25,11 @@
#include "js/HashTable.h"
#include "js/Vector.h"
struct JSAtom;
class JSAtom;
struct JSCompartment;
struct JSFunction;
struct JSFlatString;
struct JSLinearString;
class JSFunction;
class JSFlatString;
class JSLinearString;
namespace js {
@ -258,9 +258,8 @@ struct ArenaList {
void insert(ArenaHeader *arena);
};
struct ArenaLists
class ArenaLists
{
private:
/*
* For each arena kind its free list is represented as the first span with
* free things. Initially all the spans are initialized as empty. After we
@ -684,7 +683,7 @@ class GCHelperThread {
bool backgroundAllocation;
friend struct js::gc::ArenaLists;
friend class js::gc::ArenaLists;
void
replenishAndFreeLater(void *ptr);

View File

@ -148,10 +148,10 @@ struct Token;
struct TokenPos;
class TokenStream;
class ParseMapPool;
struct ParseNode;
class ParseNode;
template <typename ParseHandler>
struct Parser;
class Parser;
} /* namespace frontend */

View File

@ -279,10 +279,9 @@ typedef HashMap<JSScript *,
DefaultHasher<JSScript *>,
SystemAllocPolicy> DebugScriptMap;
struct ScriptSource
class ScriptSource
{
friend class SourceCompressorThread;
private:
union {
// Before setSourceCopy or setSource are successfully called, this union
// has a NULL pointer. When the script source is ready,
@ -1328,7 +1327,7 @@ class SourceCompressorThread
struct SourceCompressionToken
{
friend struct ScriptSource;
friend class ScriptSource;
friend class SourceCompressorThread;
private:
JSContext *cx;

View File

@ -200,7 +200,7 @@
namespace js {
struct ForkJoinSlice;
class ForkJoinSlice;
bool ForkJoin(JSContext *cx, CallArgs &args);
@ -290,7 +290,7 @@ struct ParallelBailoutRecord {
struct ForkJoinShared;
struct ForkJoinSlice : ThreadSafeContext
class ForkJoinSlice : public ThreadSafeContext
{
public:
// Which slice should you process? Ranges from 0 to |numSlices|.

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "vm/String.h"
#include "vm/String-inl.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
@ -14,7 +14,9 @@
#include "jscompartmentinlines.h"
#include "String-inl.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
using namespace js;

View File

@ -604,7 +604,7 @@ class CheckedInt
"This type is not supported by CheckedInt");
}
friend class detail::NegateImpl<T>;
friend struct detail::NegateImpl<T>;
public:
/**