Bug 125255

Summary: [WK2] Including SecItemShim.h should be guarded by ENABLE(SEC_ITEM_SHIM)
Product: WebKit Reporter: Nick Diego Yamane (diegoyam) <nick.diego>
Component: WebKit2Assignee: Nick Diego Yamane (diegoyam) <nick.diego>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, ap, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Nick Diego Yamane (diegoyam) 2013-12-04 14:29:43 PST
[WK2] Including SecItemShim.h should be guarded by ENABLE(SEC_ITEM_SHIM)
Comment 1 Nick Diego Yamane (diegoyam) 2013-12-04 14:30:42 PST
Created attachment 218449 [details]
Patch
Comment 2 Nick Diego Yamane (diegoyam) 2013-12-04 14:48:11 PST
Created attachment 218456 [details]
Patch
Comment 3 WebKit Commit Bot 2013-12-04 15:23:42 PST
Comment on attachment 218456 [details]
Patch

Clearing flags on attachment: 218456

Committed r160136: <http://trac.webkit.org/changeset/160136>
Comment 4 WebKit Commit Bot 2013-12-04 15:23:44 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Alexey Proskuryakov 2013-12-05 11:15:35 PST
> [WK2] Including SecItemShim.h should be guarded by ENABLE(SEC_ITEM_SHIM)

Why is it so? SecItemShim.h already has #if USE(SECURITY_FRAMEWORK) in it. And it's not cool that these guards don't even match.

It's best to have conditional guards inside headers, and to include them unconditionally. You win multiple things that way:

- Include lists in CPP files are smaller and better organized (nothing beats a linear alphabetic list).

- There is an opportunity to reduce build failures due to different include lists. We try to include generic headers before conditional compilation guards.

It's unfortunately not the case in SecItemShim.h when it includes Connection.h, but if this include was outside the guard as it should be, and some patch relied on SecItemShim.h including Connection.h, the patch wouldn't break the build for platforms that don't ENABLE(SEC_ITEM_SHIM).
Comment 6 Alexey Proskuryakov 2013-12-05 11:53:20 PST
(In reply to comment #5)
> And it's not cool that these guards don't even match.

Looks like my checkout was old, this changed yesterday. My other comments still stand.
Comment 7 Nick Diego Yamane (diegoyam) 2013-12-06 10:35:06 PST
(In reply to comment #5)
> > [WK2] Including SecItemShim.h should be guarded by ENABLE(SEC_ITEM_SHIM)
> 
> Why is it so? SecItemShim.h already has #if USE(SECURITY_FRAMEWORK) in it. And it's not cool that these guards don't even match.
> 
> It's best to have conditional guards inside headers, and to include them unconditionally. You win multiple things that way:
> 
> - Include lists in CPP files are smaller and better organized (nothing beats a linear alphabetic list).
> 
> - There is an opportunity to reduce build failures due to different include lists. We try to include generic headers before conditional compilation guards.
> 
> It's unfortunately not the case in SecItemShim.h when it includes Connection.h, but if this include was outside the guard as it should be, and some patch relied on SecItemShim.h including Connection.h, the patch wouldn't break the build for platforms that don't ENABLE(SEC_ITEM_SHIM).

Hi, Actually I was not sure on how to proceed to fix that build fail. Gtk and Efl build was broken because SecItemShim.h isn't in their include path, since that file is in a "/mac" directory and neither gtk nor efl build system currently include any "/mac" in their include path I preferred this guard-based solution. I asked about this issue to andersca and he recommended to add this #if as well.

Let me know if you have another better solution to this. BTW, I agree with you that we should minimize this kind of include list variations as much as we can.

Thanks