[Webkit-unassigned] [Bug 58508] Fix linking with Sun Studio 12: function pointers for extern "C" are treated differently

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 13 23:16:30 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=58508


Alexey Proskuryakov <ap at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #89530|review?, commit-queue?      |review-, commit-queue-
               Flag|                            |




--- Comment #3 from Alexey Proskuryakov <ap at webkit.org>  2011-04-13 23:16:30 PST ---
(From update of attachment 89530)
View in context: https://bugs.webkit.org/attachment.cgi?id=89530&action=review

> Source/JavaScriptCore/wtf/MainThread.h:40
> +extern "C" {
> +    typedef void MainThreadFunction(void*);
> +}

This doesn't look good to me. We use callOnMainThread in many places, and every time, we supply a C++ function to it (see e.g. Document::postTask()).

> Source/WebCore/ChangeLog:10
> +        No new tests. (OOPS!)

The patch cannot be landed with this line. You can just remove it, since it's obvious why there are no tests.

> Source/WebCore/plugins/npapi.cpp:179
> +extern "C" {
> +    void NPN_PluginThreadAsyncCall(NPP instance, void(*func) (void *), void *userData)
> +    {
> +        PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData);
> +    }
>  }

I don't understand why you had to wrap function body in extern "C". Its declaration already has extern "C", so the compiler knows that it has C linkage. Note that you didn't face a problem with NPN_ScheduleTimer, which also takes a function pointer.

Would the following change alone do the trick?

    PluginMainThreadScheduler::scheduler().scheduleCall(instance, (MainThreadFunction)func, userData);

And if that works, would a C++ style cast (probably a reinterpret_cast) work, too?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list