OSDN Git Service

Silence warnings: Ignore pedantic warnings with compiler flags
authorBen Clayton <headlessclayton@gmail.com>
Tue, 19 Feb 2019 17:08:14 +0000 (17:08 +0000)
committerBen Clayton <bclayton@google.com>
Thu, 21 Feb 2019 15:25:24 +0000 (15:25 +0000)
Addressing this one toolchain at a time, as not all warning names are the same across toolchains.

Bug: b/123933266
Change-Id: I618ebafb5ff18a885c71a8e2fa1943befc6786b6
Reviewed-on: https://swiftshader-review.googlesource.com/c/25014
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
CMakeLists.txt

index dd05fcf..90fc09a 100644 (file)
@@ -266,6 +266,17 @@ else()
         set_cpp_flag("-s" RELEASE)
     endif()
 
+    # Disable pedanitc warnings
+    if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+        set_cpp_flag("-Wno-ignored-attributes") # ignoring attributes on template argument 'X'
+        set_cpp_flag("-Wno-attributes")         # 'X' attribute ignored
+        set_cpp_flag("-Wno-comment")            # multi-line comment
+        set_cpp_flag("-Wno-noexcept-type")      # mangled name for ‘X’ will change in C++17 because the exception specification is part of a function type
+    elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        set_cpp_flag("-Wno-unneeded-internal-declaration") # function 'X' is not needed and will not be emitted
+        set_cpp_flag("-Wno-unused-private-field")          # private field 'offset' is not used - TODO: Consider enabling this once Vulkan is further implemented.
+    endif()
+
     # For distribution it is more important to be slim than super optimized
     set_cpp_flag("-Os" RELEASE)
     set_cpp_flag("-Os" RELWITHDEBINFO)
@@ -2249,6 +2260,7 @@ if(BUILD_SAMPLES)
         set_target_properties(OGLES2HelloAPI PROPERTIES
             INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
             COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
+            COMPILE_FLAGS "-Wno-deprecated-declarations" # 'NSTitledWindowMask', 'NSClosableWindowMask' is deprecated
             MACOSX_BUNDLE_INFO_PLIST "${HELLO2_DIR}/Build/OSX/Info.plist"
         )
         target_link_libraries(OGLES2HelloAPI libEGL libGLESv2 ${OS_LIBS})