Bug 21338 - IDL files use #if defined(ENABLE_whatever) instead of #if ENABLE_whatever
Summary: IDL files use #if defined(ENABLE_whatever) instead of #if ENABLE_whatever
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Mark Mentovai
Depends on:
Reported: 2008-10-03 11:48 PDT by Mark Mentovai
Modified: 2008-10-06 18:14 PDT (History)
1 user (show)

See Also:

grep -r ^#if.\*ENABLE_ . (6.26 KB, patch)
2008-10-03 12:58 PDT, Mark Mentovai
timothy: review-
Details | Formatted Diff | Diff
grep -r ^#if.\*ENABLE . (6.33 KB, patch)
2008-10-06 13:26 PDT, Mark Mentovai
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Mentovai 2008-10-03 11:48:26 PDT
IDL files use #if defined(ENABLE_whatever) instead of #if ENABLE(whatever).  This is a problem now that JavaScriptCore/wtf/Platform.h provides definitions for features that are supposed to be disabled, and features that are supposed to be disabled are properly #defined to 0.

For example, in Chromium, we want WebKit database support off, and build with -DENABLE_DATABASE=0, but files like WebCore/page/DOMWindow.idl check for:

#if defined(ENABLE_DATABASE)

Because ENABLE_DATABASE is #defined (although to 0), the preprocessor allows the conditionalized section in.  The check should be changed to:

Comment 1 Mark Mentovai 2008-10-03 12:13:12 PDT
Followup: the IDL files should use #if ENABLE_WHATEVER directly, because they are preprocessed without wtf/Platform.h being included, and the ENABLE() macro is not available.
Comment 2 Mark Mentovai 2008-10-03 12:58:29 PDT
Created attachment 24064 [details]
grep  -r ^#if.\*ENABLE_ .

I tested this out in a regular WebKit Mac build, and it seems to do what's expected of it.
Comment 3 Timothy Hatcher 2008-10-03 19:13:03 PDT
Comment on attachment 24064 [details]
grep  -r ^#if.\*ENABLE_ .

Change is fine but please add a description and bug url to the changelog.
Comment 4 Mark Mentovai 2008-10-06 13:26:06 PDT
Created attachment 24120 [details]
grep -r ^#if.\*ENABLE .
Comment 5 Eric Seidel (no email) 2008-10-06 18:14:17 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/bindings/objc/DOMEvents.h
	M	WebCore/bindings/objc/PublicDOMInterfaces.h
	M	WebCore/dom/Document.idl
	M	WebCore/page/DOMWindow.idl
	M	WebCore/svg/svgtags.in
Committed r37362