RESOLVED FIXED 28204
Not possible to build WebCore+V8 with -fno-exceptions on Mac
https://bugs.webkit.org/show_bug.cgi?id=28204
Summary Not possible to build WebCore+V8 with -fno-exceptions on Mac
Mark Mentovai
Reported Wednesday, August 12, 2009 1:52:02 AM UTC
I'm turning off C++ exception support in the Mac Chromium build. Note that it's already off in the Apple build. WebCore with V8 doesn't currently build with -fno-exceptions on the Mac because of the following snippet in WebCorePrefix.h, the prefix header implicitly included in every other file in the Mac WebCore build: /* Work around a bug with C++ library that screws up Objective-C++ when exception support is disabled. */ #if defined(__APPLE__) #undef try #undef catch #endif When exceptions are disabled, the C++ STL provides backup definitions for |try| and |catch| to allow exception-ready C++ code to build in the absence of language support for |try| and |catch|. From /usr/include/c++/4.0.0/exception_defines.h: #ifndef __EXCEPTIONS // Iff -fno-exceptions, transform error handling code to work without it. # define try if (true) # define catch(X) if (false) g++ defines __EXCEPTIONS only when exception support is enabled; it is undefined when building with -fno-exceptions. exception_defines.h is included in WebCorePrefix.h indirectly by its inclusion of <algorithm>. WebCorePrefix.h is therefore effective at blocking the STL's definitions of |try| and |catch|. This becomes a problem when a file in the WebCore build later attempts to include a bit of the STL that uses exceptions. This happens during the V8 build, when bindings/v8/V8Proxy.h bring in additional bits of STL, <iterator> and <list>. The exception_defines.h |try| and |catch| fallback macros are no longer defined, which results in a build failure. My solution to this problem is to #undef these macros only when building Objective-C[++] code, and to leave the STL definitions intact when building C++ code that's not also Objective.
Attachments
Only undefine |try| and |catch| when building Objective-C[++] (1.41 KB, patch)
2009-08-11 17:55 PDT, Mark Mentovai
darin: review+
Comments updated (1.42 KB, patch)
2009-08-11 18:01 PDT, Mark Mentovai
darin: review+
Fix "Reviewed by". (1.42 KB, patch)
2009-08-11 18:11 PDT, Mark Mentovai
abarth: review+
eric: commit-queue-
Mark Mentovai
Comment 1 Wednesday, August 12, 2009 1:55:39 AM UTC
Created attachment 34623 [details] Only undefine |try| and |catch| when building Objective-C[++]
Darin Adler
Comment 2 Wednesday, August 12, 2009 1:57:57 AM UTC
Comment on attachment 34623 [details] Only undefine |try| and |catch| when building Objective-C[++] > +/* When C++ exceptions are disabled, the C++ STL defines |try| and |catch| to > + * allow C++ code that expects exceptions to build. These definitions We use one space after a period, not two. It would be nice to have your comment follow that rule. I think the use of the term STL in this comment is a little dated. That's really not the name for it any more. This is definitely a bug in the C++ library, but one that the folks who maintain it have declined to fix.
Mark Mentovai
Comment 3 Wednesday, August 12, 2009 2:01:35 AM UTC
Created attachment 34626 [details] Comments updated
Mark Mentovai
Comment 4 Wednesday, August 12, 2009 2:11:15 AM UTC
Created attachment 34627 [details] Fix "Reviewed by".
Eric Seidel (no email)
Comment 5 Wednesday, August 12, 2009 6:30:20 PM UTC
Comment on attachment 34627 [details] Fix "Reviewed by". Rejecting patch 34627 from commit-queue. This patch will require manual commit. WebKitTools/Scripts/run-webkit-tests --no-launch-safari --quiet failed with exit code 1
Eric Seidel (no email)
Comment 6 Wednesday, August 12, 2009 6:38:33 PM UTC
Comment on attachment 34627 [details] Fix "Reviewed by". fast/layers/video-layer.html -> failed media/audio-delete-while-step-button-clicked.html -> failed media/video-controls-transformed.html -> failed media/video-controls-zoomed.html -> failed Test failures caused this regression. I don't think they were caused by this patch. Adding back to commit queue.
Eric Seidel (no email)
Comment 7 Wednesday, August 12, 2009 7:49:29 PM UTC
Comment on attachment 34627 [details] Fix "Reviewed by". Rejecting patch 34627 from commit-queue. This patch will require manual commit. Failed to run "['git', 'svn', 'dcommit']" exit_code: 1 cwd: None
Eric Seidel (no email)
Comment 8 Wednesday, August 12, 2009 8:06:00 PM UTC
Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebCore/ChangeLog M WebCore/WebCorePrefix.h Committed r47131 M WebCore/ChangeLog M WebCore/WebCorePrefix.h r47131 = e75e0df501e7cf6f156c0582d8339c21f55de469 (trunk) No changes between current HEAD and refs/remotes/trunk Resetting to the latest refs/remotes/trunk http://trac.webkit.org/changeset/47131
Note You need to log in before you can comment on or make changes to this bug.