Bug 95377 - [CMake] Suppress ANGLE compilation warnings
Summary: [CMake] Suppress ANGLE compilation warnings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords:
Depends on:
Blocks: 95342
  Show dependency treegraph
 
Reported: 2012-08-29 14:05 PDT by Rob Buis
Modified: 2012-08-30 18:55 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.67 KB, patch)
2012-08-29 14:14 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (4.94 KB, patch)
2012-08-30 09:20 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.04 KB, patch)
2012-08-30 11:19 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.08 KB, patch)
2012-08-30 12:09 PDT, Rob Buis
tonikitoo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Buis 2012-08-29 14:05:16 PDT
By compiling ANGLE into a static library (like wtf.a) we can set our compile rules for these files (partly C code) and so suppress warnings that we see now on ToT. One example of a warning that is hard to fix is the usage of -Wno-c++0x-compat on a C source.
Comment 1 Rob Buis 2012-08-29 14:14:32 PDT
Created attachment 161314 [details]
Patch
Comment 2 Raphael Kubo da Costa (:rakuco) 2012-08-29 15:08:16 PDT
Comment on attachment 161314 [details]
Patch

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

> Source/WebCore/CMakeLists.txt:2970
> +    SET_TARGET_PROPERTIES (${ANGLESupport_LIBRARY_NAME} PROPERTIES COMPILE_FLAGS "-fPIC -fvisibility=hidden -fno-exceptions -fno-strict-aliasing")

Doesn't this cause problems if one's not using gcc/clang?
Comment 3 Raphael Kubo da Costa (:rakuco) 2012-08-29 15:09:20 PDT
(In reply to comment #0)
> By compiling ANGLE into a static library (like wtf.a) we can set our compile rules for these files (partly C code) and so suppress warnings that we see now on ToT. One example of a warning that is hard to fix is the usage of -Wno-c++0x-compat on a C source.

Do you mean some of the .cpp files there are actually C source code?
Comment 4 Rob Buis 2012-08-29 17:12:22 PDT
(In reply to comment #3)
> (In reply to comment #0)
> > By compiling ANGLE into a static library (like wtf.a) we can set our compile rules for these files (partly C code) and so suppress warnings that we see now on ToT. One example of a warning that is hard to fix is the usage of -Wno-c++0x-compat on a C source.
> 
> Do you mean some of the .cpp files there are actually C source code?

I meant, ANGLE contain C sources, so using -Wno-c++0x-compat on them gives a warning. An example is ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/atom.c.
Comment 5 Rob Buis 2012-08-29 17:13:14 PDT
(In reply to comment #3)
> (In reply to comment #0)
> > By compiling ANGLE into a static library (like wtf.a) we can set our compile rules for these files (partly C code) and so suppress warnings that we see now on ToT. One example of a warning that is hard to fix is the usage of -Wno-c++0x-compat on a C source.
> 
> Do you mean some of the .cpp files there are actually C source code?

(In reply to comment #2)
> (From update of attachment 161314 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=161314&action=review
> 
> > Source/WebCore/CMakeLists.txt:2970
> > +    SET_TARGET_PROPERTIES (${ANGLESupport_LIBRARY_NAME} PROPERTIES COMPILE_FLAGS "-fPIC -fvisibility=hidden -fno-exceptions -fno-strict-aliasing")
> 
> Doesn't this cause problems if one's not using gcc/clang?

Possibly yes. I'll look into that tomorrow, thanks.
Comment 6 Raphael Kubo da Costa (:rakuco) 2012-08-29 18:14:30 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #0)
> > > By compiling ANGLE into a static library (like wtf.a) we can set our compile rules for these files (partly C code) and so suppress warnings that we see now on ToT. One example of a warning that is hard to fix is the usage of -Wno-c++0x-compat on a C source.
> > 
> > Do you mean some of the .cpp files there are actually C source code?
> 
> I meant, ANGLE contain C sources, so using -Wno-c++0x-compat on them gives a warning. An example is ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/atom.c.

Oh, I see. That makes sense; perhaps we should not set the target's COMPILE_FLAGS in WebKitHelper.cmake's WEBKIT_SET_EXTRA_COMPILER_FLAGS and just change CMAKE_C{XX}_FLAGS instead. Splitting ANGLE into a separate library is a good change regardless of that, though.
Comment 7 Rob Buis 2012-08-30 09:20:14 PDT
Created attachment 161490 [details]
Patch
Comment 8 Raphael Kubo da Costa (:rakuco) 2012-08-30 10:17:08 PDT
Comment on attachment 161490 [details]
Patch

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

> Source/cmake/WebKitHelpers.cmake:7
> +    IF (${ARGC} MATCHES "1")
> +        SET (_allowCXXWarnings "allow")
> +    ENDIF ()

Now that we require CMake 2.8.3, we can parse keyword arguments more easily. I recommend taking a look at the CMakeParseArguments module, we could then accept something like WEBKIT_SET_EXTRA_COMPILER_FLAGS(foo IGNORE_WARNINGS FALSE).
Comment 9 Raphael Kubo da Costa (:rakuco) 2012-08-30 10:28:32 PDT
(In reply to comment #8)
> we could then accept something like WEBKIT_SET_EXTRA_COMPILER_FLAGS(foo IGNORE_WARNINGS FALSE).

... Or even WEBKIT_SET_EXTRA_COMPILER_FLAGS(foo IGNORE_WARNINGS), which is more compact and makes more sense.
Comment 10 Rob Buis 2012-08-30 10:35:58 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > we could then accept something like WEBKIT_SET_EXTRA_COMPILER_FLAGS(foo IGNORE_WARNINGS FALSE).
> 
> ... Or even WEBKIT_SET_EXTRA_COMPILER_FLAGS(foo IGNORE_WARNINGS), which is more compact and makes more sense.

I agree, this sounds like a lot cleaner way to do it, thanks. Patch upcoming.
Comment 11 Rob Buis 2012-08-30 11:19:13 PDT
Created attachment 161521 [details]
Patch
Comment 12 Raphael Kubo da Costa (:rakuco) 2012-08-30 11:54:55 PDT
Comment on attachment 161521 [details]
Patch

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

> Source/cmake/WebKitHelpers.cmake:4
> +  SET(options IGNORECXX_WARNINGS)

Nit: Since there's only one argument right now it could be simpler to just pass it directly to CMAKE_PARSE_ARGUMENTS() instead of setting a variable for that.

> Source/cmake/WebKitHelpers.cmake:5
> +  CMAKE_PARSE_ARGUMENTS("OPTION" "${options}" "" "" ${ARGN} )

You likely need to INCLUDE(CMakeParseArguments), for example at the beginning of the file, before using this macro. One minor nit is that there's an extra space character before the closing ')'.
Comment 13 Rob Buis 2012-08-30 12:09:28 PDT
Created attachment 161528 [details]
Patch
Comment 14 Antonio Gomes 2012-08-30 12:38:21 PDT
Comment on attachment 161528 [details]
Patch

rs=me
Comment 15 Rob Buis 2012-08-30 13:15:08 PDT
Committed r127178: <http://trac.webkit.org/changeset/127178>