Closed Bug 1122181 Opened 9 years ago Closed 7 years ago

Stop using ::Gestalt in XPCOM

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: milan, Assigned: milan)

References

Details

Attachments

(1 file, 3 obsolete files)

There are just two places in XPCOM that use Gestalt - and one of them isn't necessary as we are only using it to see if we're on 10.5, which we don't support anymore.
Steven, you were involved in the first crack at the whole Gestalt thing, so I thought I'd run this by you first.
Attachment #8549818 - Flags: review?(smichaud)
Assignee: nobody → milan
Attachment #8549818 - Attachment is obsolete: true
Attachment #8549818 - Flags: review?(smichaud)
Attachment #8549821 - Flags: review?(smichaud)
Comment on attachment 8549821 [details] [diff] [review]
Stop using Gestalt for version in XPCOM.

This looks fine to me.  Thanks for the patch.
Attachment #8549821 - Flags: review?(smichaud) → review+
Attachment #8549821 - Attachment is obsolete: true
Hi Milan, the try run shows a bustage could you take a look at this ?
Flags: needinfo?(milan)
Keywords: checkin-needed
(In reply to Carsten Book [:Tomcat] from comment #6)
> Hi Milan, the try run shows a bustage could you take a look at this ?

That's plain strange, I was convinced I looked and saw it green.  Especially as https://treeherder.mozilla.org/#/jobs?repo=try&revision=4a672195c672 (opt, mind you) which also included this change set was.
Flags: needinfo?(milan)
My bad; we don't seem to be able to resolve functions from widget/ in xpcom/ at a first glance:

09:55:42     INFO -  Undefined symbols for architecture x86_64:
09:55:42     INFO -    "nsCocoaFeatures::OnLionOrLater()", referenced from:
09:55:42     INFO -        StackWalkInitCriticalAddress() in nsStackWalk.o
Here's the problem.  (And yes, I also missed it.)

-  MOZ_ASSERT(OnLionOrLater() || gCriticalAddress.mAddr != nullptr);
+  MOZ_ASSERT(nsCocoaFeatures::OnLionOrLater() || gCriticalAddress.mAddr != nullptr);

You need an "#if defined(MOZ_WIDGET_COCOA)" block around this.
(Following up comment #9)

Oops, that's not right.

Instead try getting rid of this:

+#if defined (DEBUG) && defined(MOZ_WIDGET_COCOA)
+#include "nsCocoaFeatures.h"
+#endif

and adding this here:

#include "nsCocoaFeatures.h"

http://hg.mozilla.org/mozilla-central/annotate/c2df1daf74c3/xpcom/base/nsStackWalk.cpp#l53

Do an all platform tryserver build to test it out.
Still a problem (https://treeherder.mozilla.org/#/jobs?repo=try&revision=0a6d653155d1).  Regarding comment 10, if it was "just" an include problem, wouldn't we have a compile time, rather than a link time error?  I wonder if xpcom/base doesn't link "to enough", compared to xpcom/io or xpcom/components which use nsCocoaFeatures and don't have this problem?
It looks like the link problem is with libdmd.  Maybe it builds its own copy of nsStackWalk?  Glandium may have some ideas.
(In reply to Andrew McCreight [:mccr8] from comment #13)
> It looks like the link problem is with libdmd.  Maybe it builds its own copy
> of nsStackWalk?

It does. See https://dxr.mozilla.org/mozilla-central/source/memory/replace/dmd/moz.build#16

Also note that libdmd is built for debug builds on the test machines but not for opt builds. So that explains why opt builds are succeeding.

Is there some library you have to link with in order to use nsCocoaFeatures::OnLionOrLater()?
To replicate this locally, add |ac_add_options --enable-dmd| to your mozconfig.
Milan, I think you should get rid of the part of your patch that imports nsCocoaFeatures::OnLionOrLater().  Just keep the part that eliminates the unnecessary OS X 10.5 version check, which (of course) is no longer needed.
Oops, sorry.  I didn't really mean for you to keep the call to Gestalt().  Instead copy over from nsCocoaFeatures.mm as much code as you need to do the OnLionOrLater() version check.  Note that you can do this without using any Objective-C syntax (which would be forbidden in a *.c/cpp file).
There is no ::Gestalt anymore in XPCOM. The last one was removed in Bug 1059424.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: