Bug 205144 - REGRESSION (r229930, r231063): WebKitLegacy.xcconfig overwrites OTHER_CFLAGS, OTHER_CPLUSPLUSFLAGS and OTHER_LDFLAGS from Base.xcconfig
Summary: REGRESSION (r229930, r231063): WebKitLegacy.xcconfig overwrites OTHER_CFLAGS,...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-12-11 16:42 PST by David Kilzer (:ddkilzer)
Modified: 2019-12-12 10:46 PST (History)
8 users (show)

See Also:


Attachments
Patch v1 (3.91 KB, patch)
2019-12-11 16:53 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2019-12-11 16:42:39 PST
WebKitLegacy.xcconfig overwrites OTHER_CFLAGS, OTHER_CPLUSPLUSFLAGS and OTHER_LDFLAGS from Base.xcconfig.

These Xcode variables are defined like this in WebKitLegacy.xcconfig:

OTHER_CFLAGS = $(OTHER_CFLAGS_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
[...]
OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS);
[...]
OTHER_LDFLAGS = -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit $(WK_APPKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);

This overwrites the values defined in Base.xcconfig:

OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);

I found this because I was (ab)using Tools/asan/asan.xcconfig to set a compiler flag in every project by doing it in one place:

-ASAN_OTHER_CFLAGS = -fno-omit-frame-pointer -g;
+ASAN_OTHER_CFLAGS = -fno-omit-frame-pointer -g -O0 -DRELEASE_WITHOUT_OPTIMIZATIONS=1;

Then the WebKitLegacy project failed to compile because -DRELEASE_WITHOUT_OPTIMIZATIONS=1 was not set when building source with a Release configuration and compiler optimizations disabled.
Comment 1 David Kilzer (:ddkilzer) 2019-12-11 16:45:59 PST
The OTHER_C[PLUSPLUS]FLAGS change regressed in r231063 for Bug 185006.

The OTHER_LDFLAGS change regressed in r229930 for Bug 183948.
Comment 2 David Kilzer (:ddkilzer) 2019-12-11 16:53:06 PST
Created attachment 385458 [details]
Patch v1
Comment 3 Alexey Proskuryakov 2019-12-12 09:49:50 PST
Comment on attachment 385458 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=385458&action=review

> Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig:47
> +OTHER_CFLAGS_COCOA_TOUCH = $(OTHER_CFLAGS_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));

Is it always YES or NO, or can it be empty? If the latter, then we also need OTHER_CFLAGS_COCOA_TOUCH_ - which is typical for most variables in xcconfigs.

Your patch doesn't change this aspect, but worth taking the opportunity to confirm.
Comment 4 David Kilzer (:ddkilzer) 2019-12-12 10:00:51 PST
Comment on attachment 385458 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=385458&action=review

>> Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig:47
>> +OTHER_CFLAGS_COCOA_TOUCH = $(OTHER_CFLAGS_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
> 
> Is it always YES or NO, or can it be empty? If the latter, then we also need OTHER_CFLAGS_COCOA_TOUCH_ - which is typical for most variables in xcconfigs.
> 
> Your patch doesn't change this aspect, but worth taking the opportunity to confirm.

WK_IS_COCOA_TOUCH is defined in Source/WebKitLegacy/mac/Configurations/Base.xcconfig:

WK_IS_COCOA_TOUCH = $(WK_NOT_$(WK_EMPTY_$(WK_COCOA_TOUCH)));

And the other macros are defined in Source/WebKitLegacy/mac/Configurations/SDKVariant.xcconfig:

WK_EMPTY_ = YES;
WK_NOT_ = YES;
WK_NOT_YES = NO;

So WK_IS_COCOA_TOUCH is always defined as YES or NO.
Comment 5 WebKit Commit Bot 2019-12-12 10:45:58 PST
Comment on attachment 385458 [details]
Patch v1

Clearing flags on attachment: 385458

Committed r253439: <https://trac.webkit.org/changeset/253439>
Comment 6 WebKit Commit Bot 2019-12-12 10:46:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-12-12 10:46:20 PST
<rdar://problem/57883449>