Hi,

Have you ever struggled with one of GCC's "used but never defined"
warnings?  I certainly have, and I've just now worked out a good way
to work out what the problem is.  Take this example:

../../gc/Barrier.h:489:17: warning: inline function ‘void
js::HeapSlot::init(JSRuntime*, JSObject*, js::HeapSlot::Kind,
uint32_t, const JS::Value&)’ used but never defined [enabled by
default]

What I do is rename that function to something that will cause a
compile error at its use sites, e.g. init2().  I then recompile.  The
first compile error is very likely to be the problem.  In this case I
got the following:

../vm/ObjectImpl-inl.h: In member function ‘void
js::ObjectImpl::initializeSlotRange(uint32_t, uint32_t)’:
../vm/ObjectImpl-inl.h:226:85: error: no matching function for call to
‘js::HeapSlot::init(JSRuntime*&, JSObject*, js::HeapSlot::Kind,
uint32_t, JS::Value)’

And sure enough, vm/ObjectImpl-inl.h is using HeapSlot::init() but it
doesn't #include gc/Barrier-inl.h, which defines HeapSlot::init().

It might not be the first compile error (though in my experience it
usually is), but it will be an error in a .h file.

Now this doesn't tell you how to fix it, but at least it tells you
where the problem is, which is often the hard part (in my experience).

Nick

ps: jorendorff and I are working on detangling SpiderMonkey's horrific
#include hairball.  See
https://bugzilla.mozilla.org/show_bug.cgi?id=880088 and the dependent
bugs if you want to follow along.  This should simplify things, and
hopefully also reduce build times.
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to