Lots of build warnings from Source/ThirdParty/openvr
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Feb 2018 08:17:17 +0000 (08:17 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Feb 2018 08:17:17 +0000 (08:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182117

Reviewed by Michael Catanzaro.

Suppress OpenVR compiler warnings by listing -Wno-unknown-pragmas,
-Wno-unused-parameter and -Wno-unused-variable options among the
libopenvr_api.so CXX flags.

CMake configuration warning about default project variables for the
openvr_api project is avoided by removing the openvr_api project and
instead setting the OPENVR_SOURCE_DIR to the path of the OpenVR
source directory under Source/ThirdParty/.

Another compiler warning is removed by fixing the return condition in
the Path_WriteBinaryFile() function to perform an equality comparison
instead of an assignment. This has already been fixed upstream.

All changes to the OpenVR code are reflected in the separately-managed
patch files kept in the patches/ directory.

* openvr/README.webkit:
* openvr/patches/Path_WriteBinaryFile-fix-return-condition.patch: Added.
* openvr/patches/cmake-build.patch:
* openvr/src/CMakeLists.txt:
* openvr/src/vrcommon/pathtools_public.cpp:
(Path_WriteBinaryFile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/ThirdParty/ChangeLog
Source/ThirdParty/openvr/README.webkit
Source/ThirdParty/openvr/patches/Path_WriteBinaryFile-fix-return-condition.patch [new file with mode: 0644]
Source/ThirdParty/openvr/patches/cmake-build.patch
Source/ThirdParty/openvr/src/CMakeLists.txt
Source/ThirdParty/openvr/src/vrcommon/pathtools_public.cpp

index e528334..5647c13 100644 (file)
@@ -1,3 +1,33 @@
+2018-02-04  Zan Dobersek  <zdobersek@igalia.com>
+
+        Lots of build warnings from Source/ThirdParty/openvr
+        https://bugs.webkit.org/show_bug.cgi?id=182117
+
+        Reviewed by Michael Catanzaro.
+
+        Suppress OpenVR compiler warnings by listing -Wno-unknown-pragmas,
+        -Wno-unused-parameter and -Wno-unused-variable options among the
+        libopenvr_api.so CXX flags.
+
+        CMake configuration warning about default project variables for the
+        openvr_api project is avoided by removing the openvr_api project and
+        instead setting the OPENVR_SOURCE_DIR to the path of the OpenVR
+        source directory under Source/ThirdParty/.
+
+        Another compiler warning is removed by fixing the return condition in
+        the Path_WriteBinaryFile() function to perform an equality comparison
+        instead of an assignment. This has already been fixed upstream.
+
+        All changes to the OpenVR code are reflected in the separately-managed
+        patch files kept in the patches/ directory.
+
+        * openvr/README.webkit:
+        * openvr/patches/Path_WriteBinaryFile-fix-return-condition.patch: Added.
+        * openvr/patches/cmake-build.patch:
+        * openvr/src/CMakeLists.txt:
+        * openvr/src/vrcommon/pathtools_public.cpp:
+        (Path_WriteBinaryFile):
+
 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] Make WTF headers copies
index 4ff9782..8dbb76e 100644 (file)
@@ -14,8 +14,10 @@ which corresponds to 1.0.10 release.
 WebKit changes:
 * patches/cmake-build.patch: script used to allow openvr CMake build to be
 integrated into WebKit build
+* patches/Path_WriteBinaryFile-fix-return-condition.patch: suppresses a
+compiler warning, but otherwise already applied upstream in 1.0.12
 * Removed bin/ directory. Not needed as it includes precompiled libraries
 * Removed lib/ directory. Not needed as it includes precompiled libraries
 * Removed controller_callouts/ directory. Unneeded docs
 * Removed samples/ directory.
-* Replaced tabs by whitespaces to make check-webkit-style happy.
\ No newline at end of file
+* Replaced tabs by whitespaces to make check-webkit-style happy.
diff --git a/Source/ThirdParty/openvr/patches/Path_WriteBinaryFile-fix-return-condition.patch b/Source/ThirdParty/openvr/patches/Path_WriteBinaryFile-fix-return-condition.patch
new file mode 100644 (file)
index 0000000..f6608a6
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/src/vrcommon/pathtools_public.cpp b/src/vrcommon/pathtools_public.cpp
+index 7f7c7e8..de7a72a 100644
+--- a/src/vrcommon/pathtools_public.cpp
++++ b/src/vrcommon/pathtools_public.cpp
+@@ -655,7 +655,7 @@ bool Path_WriteBinaryFile(const std::string &strFilename, unsigned char *pData,
+               fclose(f);
+        }
+-       return written = nSize ? true : false;
++       return written == nSize ? true : false;
+ }
+ std::string Path_ReadTextFile( const std::string &strFilename )
index 58963c2..2c14029 100644 (file)
@@ -1,5 +1,5 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 94de3ce..6decedd 100644
+index d7025c0db4b..d13a7f90cf8 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -1,14 +1,8 @@
@@ -40,10 +40,13 @@ index 94de3ce..6decedd 100644
  if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
         # Enable c++11 and hide symbols which shouldn't be visible
 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 58954d6..8b537af 100644
+index e58c9e1c039..095f81e562b 100644
 --- a/src/CMakeLists.txt
 +++ b/src/CMakeLists.txt
-@@ -3,6 +3,9 @@ project(openvr_api)
+@@ -1,8 +1,10 @@
+-# Project name.
+-project(openvr_api)
++set(OPENVR_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/openvr)
  
  set( LIBNAME "openvr_api" )
  
@@ -53,16 +56,16 @@ index 58954d6..8b537af 100644
  # Set some properies for specific files.
  if(APPLE)
    set(CMAKE_MACOSX_RPATH 1)
-@@ -22,7 +25,7 @@ elseif(WIN32)
+@@ -22,7 +24,7 @@ elseif(WIN32)
  endif()
  
  # Add include folders.
 -include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/headers ${CMAKE_SOURCE_DIR}/src/vrcommon)
-+include_directories(${PROJECT_SOURCE_DIR}/../src ${PROJECT_SOURCE_DIR}/../headers ${PROJECT_SOURCE_DIR}/../src/vrcommon)
++include_directories(${OPENVR_SOURCE_DIR}/src ${OPENVR_SOURCE_DIR}/headers ${OPENVR_SOURCE_DIR}/src/vrcommon)
  
  if(USE_CUSTOM_LIBCXX)
         link_directories(
-@@ -65,22 +68,22 @@ elseif(BUILD_FRAMEWORK)
+@@ -65,28 +67,34 @@ elseif(BUILD_FRAMEWORK)
         set( LIBNAME "OpenVR" )
         add_library( ${LIBNAME} 
              SHARED ${SOURCE_FILES}
@@ -71,24 +74,36 @@ index 58954d6..8b537af 100644
 -            ${CMAKE_SOURCE_DIR}/headers/openvr_api.json
 -            ${CMAKE_SOURCE_DIR}/headers/openvr_capi.h
 -            ${CMAKE_SOURCE_DIR}/headers/openvr_driver.h
-+            ${PROJECT_SOURCE_DIR}/../headers/openvr.h
-+            ${PROJECT_SOURCE_DIR}/../headers/openvr_api.cs
-+            ${PROJECT_SOURCE_DIR}/../headers/openvr_api.json
-+            ${PROJECT_SOURCE_DIR}/../headers/openvr_capi.h
-+            ${PROJECT_SOURCE_DIR}/../headers/openvr_driver.h
++            ${OPENVR_SOURCE_DIR}/headers/openvr.h
++            ${OPENVR_SOURCE_DIR}/headers/openvr_api.cs
++            ${OPENVR_SOURCE_DIR}/headers/openvr_api.json
++            ${OPENVR_SOURCE_DIR}/headers/openvr_capi.h
++            ${OPENVR_SOURCE_DIR}/headers/openvr_driver.h
         )
         set_target_properties(OpenVR PROPERTIES
                FRAMEWORK TRUE
                FRAMEWORK_VERSION A
                MACOSX_FRAMEWORK_IDENTIFIER com.valvesoftware.OpenVR.framework
 -              MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/Info.plist
-+              MACOSX_FRAMEWORK_INFO_PLIST ${PROJECT_SOURCE_DIR}/../src/Info.plist
++              MACOSX_FRAMEWORK_INFO_PLIST ${OPENVR_SOURCE_DIR}/src/Info.plist
                # "current version" in semantic format in Mach-O binary file
                VERSION 1.0.6
                # "compatibility version" in semantic format in Mach-O binary file
                SOVERSION 1.0.0
 -              PUBLIC_HEADER "${CMAKE_SOURCE_DIR}/headers/openvr.h;${CMAKE_SOURCE_DIR}/headers/openvr_api.cs;${CMAKE_SOURCE_DIR}/headers/openvr_api.json;${CMAKE_SOURCE_DIR}/headers/openvr_capi.h;${CMAKE_SOURCE_DIR}/headers/openvr_driver.h"
-+              PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/../headers/openvr.h;${PROJECT_SOURCE_DIR}/../headers/openvr_api.cs;${PROJECT_SOURCE_DIR}/../headers/openvr_api.json;${PROJECT_SOURCE_DIR}/../headers/openvr_capi.h;${PROJECT_SOURCE_DIR}/../headers/openvr_driver.h"
++              PUBLIC_HEADER "${OPENVR_SOURCE_DIR}/headers/openvr.h;${OPENVR_SOURCE_DIR}/headers/openvr_api.cs;${OPENVR_SOURCE_DIR}/headers/openvr_api.json;${OPENVR_SOURCE_DIR}/headers/openvr_capi.h;${OPENVR_SOURCE_DIR}/headers/openvr_driver.h"
                LINKER_LANGUAGE CXX
         )
  else()
+        add_library(${LIBNAME} STATIC ${SOURCE_FILES})
+ endif()
++if (COMPILER_IS_GCC_OR_CLANG)
++    WEBKIT_ADD_TARGET_CXX_FLAGS(${LIBNAME} -Wno-unknown-pragmas
++                                           -Wno-unused-parameter
++                                           -Wno-unused-variable)
++endif()
++
+ if(USE_CUSTOM_LIBCXX)
+        set(EXTRA_LIBS ${EXTRA_LIBS} c++ c++abi)
+ endif()
index d50e689..095f81e 100644 (file)
@@ -1,5 +1,4 @@
-# Project name.
-project(openvr_api)
+set(OPENVR_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/openvr)
 
 set( LIBNAME "openvr_api" )
 
@@ -25,7 +24,7 @@ elseif(WIN32)
 endif()
 
 # Add include folders.
-include_directories(${PROJECT_SOURCE_DIR}/../src ${PROJECT_SOURCE_DIR}/../headers ${PROJECT_SOURCE_DIR}/../src/vrcommon)
+include_directories(${OPENVR_SOURCE_DIR}/src ${OPENVR_SOURCE_DIR}/headers ${OPENVR_SOURCE_DIR}/src/vrcommon)
 
 if(USE_CUSTOM_LIBCXX)
        link_directories(
@@ -68,28 +67,34 @@ elseif(BUILD_FRAMEWORK)
        set( LIBNAME "OpenVR" )
        add_library( ${LIBNAME} 
             SHARED ${SOURCE_FILES}
-            ${PROJECT_SOURCE_DIR}/../headers/openvr.h
-            ${PROJECT_SOURCE_DIR}/../headers/openvr_api.cs
-            ${PROJECT_SOURCE_DIR}/../headers/openvr_api.json
-            ${PROJECT_SOURCE_DIR}/../headers/openvr_capi.h
-            ${PROJECT_SOURCE_DIR}/../headers/openvr_driver.h
+            ${OPENVR_SOURCE_DIR}/headers/openvr.h
+            ${OPENVR_SOURCE_DIR}/headers/openvr_api.cs
+            ${OPENVR_SOURCE_DIR}/headers/openvr_api.json
+            ${OPENVR_SOURCE_DIR}/headers/openvr_capi.h
+            ${OPENVR_SOURCE_DIR}/headers/openvr_driver.h
        )
        set_target_properties(OpenVR PROPERTIES
               FRAMEWORK TRUE
               FRAMEWORK_VERSION A
               MACOSX_FRAMEWORK_IDENTIFIER com.valvesoftware.OpenVR.framework
-              MACOSX_FRAMEWORK_INFO_PLIST ${PROJECT_SOURCE_DIR}/../src/Info.plist
+              MACOSX_FRAMEWORK_INFO_PLIST ${OPENVR_SOURCE_DIR}/src/Info.plist
               # "current version" in semantic format in Mach-O binary file
               VERSION 1.0.6
               # "compatibility version" in semantic format in Mach-O binary file
               SOVERSION 1.0.0
-              PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/../headers/openvr.h;${PROJECT_SOURCE_DIR}/../headers/openvr_api.cs;${PROJECT_SOURCE_DIR}/../headers/openvr_api.json;${PROJECT_SOURCE_DIR}/../headers/openvr_capi.h;${PROJECT_SOURCE_DIR}/../headers/openvr_driver.h"
+              PUBLIC_HEADER "${OPENVR_SOURCE_DIR}/headers/openvr.h;${OPENVR_SOURCE_DIR}/headers/openvr_api.cs;${OPENVR_SOURCE_DIR}/headers/openvr_api.json;${OPENVR_SOURCE_DIR}/headers/openvr_capi.h;${OPENVR_SOURCE_DIR}/headers/openvr_driver.h"
               LINKER_LANGUAGE CXX
        )
 else()
        add_library(${LIBNAME} STATIC ${SOURCE_FILES})
 endif()
 
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(${LIBNAME} -Wno-unknown-pragmas
+                                           -Wno-unused-parameter
+                                           -Wno-unused-variable)
+endif()
+
 if(USE_CUSTOM_LIBCXX)
        set(EXTRA_LIBS ${EXTRA_LIBS} c++ c++abi)
 endif()
index 7d3458d..4a1a512 100644 (file)
@@ -655,7 +655,7 @@ bool Path_WriteBinaryFile(const std::string &strFilename, unsigned char *pData,
               fclose(f);
        }
 
-       return written = nSize ? true : false;
+       return written == nSize ? true : false;
 }
 
 std::string Path_ReadTextFile( const std::string &strFilename )