Bug 146007 - Remove build warnings in Tools/DumpRenderTree/TestNetscapePlugIn
Summary: Remove build warnings in Tools/DumpRenderTree/TestNetscapePlugIn
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-15 23:16 PDT by Tanay
Modified: 2015-06-23 03:46 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.37 KB, patch)
2015-06-15 23:20 PDT, Tanay
no flags Details | Formatted Diff | Diff
Patch (3.19 KB, patch)
2015-06-19 05:04 PDT, Tanay
no flags Details | Formatted Diff | Diff
Patch (3.28 KB, patch)
2015-06-22 05:07 PDT, Tanay
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tanay 2015-06-15 23:16:39 PDT
../../Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:68:108: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
     messageLength += vsnprintf(message + messageLength, messageBufferSize - 1 - messageLength, format, args);
                                                                                                            ^
../../Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:68:108: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
Comment 1 Tanay 2015-06-15 23:20:38 PDT
Created attachment 254937 [details]
Patch
Comment 2 Darin Adler 2015-06-16 10:51:03 PDT
Comment on attachment 254937 [details]
Patch

I am pretty sure you could use attribute rather than __attribute__. In macros it makes sense to use the form less likely to conflict, but in code like this it doesn’t seem necessary.
Comment 3 Darin Adler 2015-06-16 10:52:12 PDT
Comment on attachment 254937 [details]
Patch

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

For best compatibility across platforms would be much better to use WTF_ATTRIBUTE_PRINTF. Please do that.

> Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:63
> +void __attribute__((format(printf, 2, 0))) pluginLogWithArguments(NPP instance, const char* format, va_list args)

Oops, no this is wrong. Needs to use WTF_ATTRIBUTE_PRINTF
Comment 4 Gyuyoung Kim 2015-06-16 22:41:58 PDT
Comment on attachment 254937 [details]
Patch

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

> Tools/ChangeLog:3
> +        [EFL] Remove build warnings in Tools/DumpRenderTree/TestNetscapePlugIn

I think this patch isn't only for EFL port. Please remove [EFL] prefix or add other ports too.
Comment 5 Tanay 2015-06-16 23:54:32 PDT
I am getting compilation errors if this macro is used. 

It seems like the 'WTF_ATTRIBUTE_PRINTF' macro is not available in this directory.  

This is conditionally compiled for ENABLE_X11_TARGET flag. 
      if (ENABLE_X11_TARGET)
        add_subdirectory(DumpRenderTree/TestNetscapePlugIn)

Please advice.
Comment 6 Darin Adler 2015-06-17 11:00:08 PDT
(In reply to comment #5)
> I am getting compilation errors if this macro is used. 
> 
> It seems like the 'WTF_ATTRIBUTE_PRINTF' macro is not available in this
> directory.  

I don’t think it’s the directory, but rather the includes. You’ll have to include an appropriate WTF header file to use WTF_ATTRIBUTE_PRINTF. It doesn’t compile because it’s not including the header file. I think it’s <wtf/Assertions.h>.

> This is conditionally compiled for ENABLE_X11_TARGET flag. 
>       if (ENABLE_X11_TARGET)
>         add_subdirectory(DumpRenderTree/TestNetscapePlugIn)

That’s in the make file used for the EFL port. This same plug-in is built, just built with other build systems, for other ports that don’t necessarily share that make file.
Comment 7 Tanay 2015-06-18 04:41:34 PDT
After including the <wtf/Assertions.h> header and I get the following error

../../Source/WTF/wtf/Assertions.h:130:1: error: ‘WTF_EXPORT_PRIVATE’ does not name a type
Comment 8 Tanay 2015-06-19 00:02:51 PDT
Are there some additional dependencies that I am missing?
I have tried linking with the WTF library but it does not resolve.
Comment 9 Csaba Osztrogonác 2015-06-19 02:15:53 PDT
(In reply to comment #8)
> Are there some additional dependencies that I am missing?
> I have tried linking with the WTF library but it does not resolve.

Assertions.h needs WTF_EXPORT_PRIVATE, which is defined in wtf/ExportMacros.h.
And wtf/ExportMacros.h needs OS/USE/COMPILER macros which are defined in Platform.h.

Adding these includes in exactly this order + adding WTF to include path
in cmake build system solves this issue ... But it is very ugly and
style checker will warn because of unordered includes ...

#include <wtf/Platform.h>
#include <wtf/ExportMacros.h>
#include <wtf/Assertions.h>
Comment 10 Tanay 2015-06-19 05:04:25 PDT
Created attachment 255187 [details]
Patch
Comment 11 Tanay 2015-06-19 05:05:36 PDT
Thanks for the clarifications. Uploaded a patch with the changes.
Comment 12 Darin Adler 2015-06-19 10:51:22 PDT
I’m surprised that Assertions.h does not itself include those other headers. I think maybe it’s because we expect those other headers to be included universally as part of config.h or precompiled headers.
Comment 13 WebKit Commit Bot 2015-06-22 00:26:13 PDT
Comment on attachment 255187 [details]
Patch

Rejecting attachment 255187 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-03', 'apply-attachment', '--no-update', '--non-interactive', 255187, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
zz 3.
patching file Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt
Hunk #1 FAILED at 33.
1 out of 1 hunk FAILED -- saving rejects to file Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt.rej
patching file Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
patching file Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Darin Adler']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: http://webkit-queues.appspot.com/results/4736415837454336
Comment 14 Tanay 2015-06-22 05:07:34 PDT
Created attachment 255342 [details]
Patch
Comment 15 Tanay 2015-06-22 05:08:48 PDT
Re-based and uploaded the patch.
Comment 16 WebKit Commit Bot 2015-06-23 03:46:16 PDT
Comment on attachment 255342 [details]
Patch

Clearing flags on attachment: 255342

Committed r185871: <http://trac.webkit.org/changeset/185871>
Comment 17 WebKit Commit Bot 2015-06-23 03:46:20 PDT
All reviewed patches have been landed.  Closing bug.