Bug 21338

Summary: IDL files use #if defined(ENABLE_whatever) instead of #if ENABLE_whatever
Product: WebKit Reporter: Mark Mentovai <mark>
Component: PlatformAssignee: Mark Mentovai <mark>
Status: RESOLVED FIXED    
Severity: Normal CC: eric
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
grep -r ^#if.\*ENABLE_ .
timothy: review-
grep -r ^#if.\*ENABLE . timothy: review+

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:

#if ENABLE(DATABASE)
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