Bug 210225

Summary: Add curly braces after one line if statement for the case when we aren't using the internal SDK
Product: WebKit Reporter: Kate Cheney <katherine_cheney>
Component: WebKit Misc.Assignee: Kate Cheney <katherine_cheney>
Status: RESOLVED FIXED    
Severity: Normal CC: ddkilzer, jbedard, ryanhaddad, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Kate Cheney 2020-04-08 16:45:37 PDT
If there are no braces and WEBSITE_DATA_STORE_ADDITIONS is empty, this if-statement includes the following line, causing test failures.
Comment 1 Radar WebKit Bug Importer 2020-04-08 16:46:39 PDT
<rdar://problem/61485209>
Comment 2 Kate Cheney 2020-04-08 16:48:16 PDT
Created attachment 395887 [details]
Patch
Comment 3 David Kilzer (:ddkilzer) 2020-04-08 16:57:11 PDT
Comment on attachment 395887 [details]
Patch

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

r=me to fix tests, even though this is technically a style violation.

> Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:430
>                  WEBSITE_DATA_STORE_ADDITIONS

Eventually, the `WEBSITE_DATA_STORE_ADDITIONS` macro should probably have a do { ... } while(0) loop around its contents if it's multi-line, and maybe defined to `(void)0` if it is not set (in this file.  Then the curly braces can be removed.
Comment 4 David Kilzer (:ddkilzer) 2020-04-08 17:00:25 PDT
Comment on attachment 395887 [details]
Patch

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

>> Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:430
>>                  WEBSITE_DATA_STORE_ADDITIONS
> 
> Eventually, the `WEBSITE_DATA_STORE_ADDITIONS` macro should probably have a do { ... } while(0) loop around its contents if it's multi-line, and maybe defined to `(void)0` if it is not set (in this file.  Then the curly braces can be removed.

Another way to fix this is:

#ifndef WEBSITE_DATA_STORE_ADDITIONS
#define WEBSITE_DATA_STORE_ADDITIONS (void)0
#endif

At the top of the file.  Then you can remove the curly brances and make the style bot happy.

r=me either way you decide to fix.
Comment 5 EWS 2020-04-08 17:20:19 PDT
Committed r259768: <https://trac.webkit.org/changeset/259768>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395887 [details].