Bug 224462

Summary: Remove warnings caused by export g_config extern definition in WTFConfig.h
Product: WebKit Reporter: Basuke Suzuki <Basuke.Suzuki>
Component: PlatformAssignee: Basuke Suzuki <Basuke.Suzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, Basuke.Suzuki, don.olmstead, ews-watchlist, gyuyoung.kim, ross.kirsling, ryuan.choi, sergio, stephan.szabo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
PATCH
ews-feeder: commit-queue-
PATCH
none
PATCH
none
PATCH
ews-feeder: commit-queue-
PATCH none

Description Basuke Suzuki 2021-04-12 17:03:32 PDT
Suppress hundreds of warnings while building PlayStation branch.

WTF/Headers\wtf/WTFConfig.h:49:36: warning: redeclaration of 'WebConfig::g_config' should not add 'dllimport' attribute [-Wdll-attribute-on-redeclaration]
extern "C" WTF_EXPORT_PRIVATE Slot g_config[];
                                   ^
bmalloc/Headers\bmalloc/GigacageConfig.h:38:17: note: previous declaration is here
extern "C" Slot g_config[];
                ^
1 warning generated.
Comment 1 Basuke Suzuki 2021-04-12 17:12:02 PDT
Created attachment 425813 [details]
PATCH
Comment 2 Stephan Szabo 2021-04-12 18:20:11 PDT
Comment on attachment 425813 [details]
PATCH

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

> Source/bmalloc/bmalloc/GigacageConfig.h:38
> +extern "C" BEXPORT Slot g_config[];

This seems like it would work for normal configurations on declspec platforms where bmalloc is built statically into WTF or a higher level. I think bmalloc as a shared library might still get warnings though as we'd presumably get dllimport in WTF. To get around that, we might have to be using something that would be nothing if we're building bmalloc, and equivalent to WTF_EXPORT_PRIVATE when included by WTF or a higher layer.

The whole dependency on the item linking to bmalloc providing the space feels unfortunate, but given that the redeclaration warning presumably only happens on platforms using declspec, maybe it'd be easier to just disable the warning since it seems like it's indicative of a possible problem that we don't see in practice.
Comment 3 Basuke Suzuki 2021-04-14 14:51:41 PDT
Created attachment 426048 [details]
PATCH
Comment 4 Basuke Suzuki 2021-04-14 14:55:54 PDT
Created attachment 426051 [details]
PATCH
Comment 5 Stephan Szabo 2021-04-14 16:55:01 PDT
Comment on attachment 426051 [details]
PATCH

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

> Source/cmake/OptionsPlayStation.cmake:16
> +add_compile_options(-Wno-dll-attribute-on-redeclaration)

We should see if using the WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS (or WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS although the former is recommended) macro from WebKitCompilerFlags.cmake will work for this.

The above should be fine if it doesn't, but it'll let us get any additional behavior added in the future.
Comment 6 Basuke Suzuki 2021-04-14 17:38:51 PDT
(In reply to Stephan Szabo from comment #5)
> Comment on attachment 426051 [details]
> PATCH
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=426051&action=review
> 
> > Source/cmake/OptionsPlayStation.cmake:16
> > +add_compile_options(-Wno-dll-attribute-on-redeclaration)
> 
> We should see if using the WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS (or
> WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS although the former is recommended)
> macro from WebKitCompilerFlags.cmake will work for this.
> 
> The above should be fine if it doesn't, but it'll let us get any additional
> behavior added in the future.

Oh, thanks. I've never heard about that macro. Let's see.
Comment 7 Basuke Suzuki 2021-04-14 23:31:22 PDT
Created attachment 426077 [details]
PATCH
Comment 8 Basuke Suzuki 2021-04-15 07:56:15 PDT
Created attachment 426104 [details]
PATCH
Comment 9 EWS 2021-04-15 08:48:18 PDT
Committed r276022 (236574@main): <https://commits.webkit.org/236574@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426104 [details].
Comment 10 Radar WebKit Bug Importer 2021-04-15 08:49:16 PDT
<rdar://problem/76705157>