Bug 210225 - Add curly braces after one line if statement for the case when we aren't using the internal SDK
Summary: Add curly braces after one line if statement for the case when we aren't usin...
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: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-08 16:45 PDT by Kate Cheney
Modified: 2020-04-08 17:20 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.62 KB, patch)
2020-04-08 16:48 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].