Bug 28204 - Not possible to build WebCore+V8 with -fno-exceptions on Mac
Summary: Not possible to build WebCore+V8 with -fno-exceptions on Mac
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-11 17:52 PDT by Mark Mentovai
Modified: 2009-08-12 12:06 PDT (History)
2 users (show)

See Also:


Attachments
Only undefine |try| and |catch| when building Objective-C[++] (1.41 KB, patch)
2009-08-11 17:55 PDT, Mark Mentovai
darin: review+
Details | Formatted Diff | Diff
Comments updated (1.42 KB, patch)
2009-08-11 18:01 PDT, Mark Mentovai
darin: review+
Details | Formatted Diff | Diff
Fix "Reviewed by". (1.42 KB, patch)
2009-08-11 18:11 PDT, Mark Mentovai
abarth: review+
eric: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Mentovai 2009-08-11 17:52:02 PDT
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.
Comment 1 Mark Mentovai 2009-08-11 17:55:39 PDT
Created attachment 34623 [details]
Only undefine |try| and |catch| when building Objective-C[++]
Comment 2 Darin Adler 2009-08-11 17:57:57 PDT
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.
Comment 3 Mark Mentovai 2009-08-11 18:01:35 PDT
Created attachment 34626 [details]
Comments updated
Comment 4 Mark Mentovai 2009-08-11 18:11:15 PDT
Created attachment 34627 [details]
Fix "Reviewed by".
Comment 5 Eric Seidel (no email) 2009-08-12 10:30:20 PDT
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
Comment 6 Eric Seidel (no email) 2009-08-12 10:38:33 PDT
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.
Comment 7 Eric Seidel (no email) 2009-08-12 11:49:29 PDT
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
Comment 8 Eric Seidel (no email) 2009-08-12 12:06:00 PDT
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