Bug 182117 - Lots of build warnings from Source/ThirdParty/openvr
Summary: Lots of build warnings from Source/ThirdParty/openvr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-25 11:36 PST by Michael Catanzaro
Modified: 2018-02-05 14:19 PST (History)
4 users (show)

See Also:


Attachments
Patch (11.49 KB, patch)
2018-02-03 09:13 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch for landing (11.67 KB, patch)
2018-02-03 23:28 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2018-01-25 11:36:36 PST
I'm seeing a bunch of build warnings from Source/ThirdParty/openvr with GCC 7.2.1. The build should remain warning-free on all of the compilers we use. Most of these look like old warnings that should occur with any compiler version.

Since it's third-party code, it's usually best to disable the warnings in the CMakeLists.txt by using WEBKIT_ADD_TARGET_CXX_FLAGS. Alternatively, the code code be modified to suppress the warnings.

[119/2518] Building CXX object Source/...api.dir/vrcommon/dirtools_public.cpp.o
In file included from ../../Source/ThirdParty/openvr/src/vrcommon/dirtools_public.cpp:3:0:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void wcsncpy_s(wchar_t*, size_t, const wchar_t*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:72:99: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
                                                                                                   ^~~~~
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void strncpy_s(char*, size_t, const char*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:78:93: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
                                                                                             ^~~~~
[120/2518] Building CXX object Source/...openvr_api.dir/openvr_api_public.cpp.o
In file included from ../../Source/ThirdParty/openvr/src/openvr_api_public.cpp:9:0:
../../Source/ThirdParty/openvr/src/../src/vrcommon/vrpathregistry_public.h:10:20: warning: ‘k_pchLogOverrideVar’ defined but not used [-Wunused-variable]
 static const char *k_pchLogOverrideVar = "VR_LOG_PATH";
                    ^~~~~~~~~~~~~~~~~~~
../../Source/ThirdParty/openvr/src/../src/vrcommon/vrpathregistry_public.h:9:20: warning: ‘k_pchConfigOverrideVar’ defined but not used [-Wunused-variable]
 static const char *k_pchConfigOverrideVar = "VR_CONFIG_PATH";
                    ^~~~~~~~~~~~~~~~~~~~~~
../../Source/ThirdParty/openvr/src/../src/vrcommon/vrpathregistry_public.h:8:20: warning: ‘k_pchRuntimeOverrideVar’ defined but not used [-Wunused-variable]
 static const char *k_pchRuntimeOverrideVar = "VR_OVERRIDE";
                    ^~~~~~~~~~~~~~~~~~~~~~~
[127/2518] Building CXX object Source/...pi.dir/vrcommon/pathtools_public.cpp.o
In file included from ../../Source/ThirdParty/openvr/src/vrcommon/pathtools_public.cpp:2:0:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void wcsncpy_s(wchar_t*, size_t, const wchar_t*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:72:99: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
                                                                                                   ^~~~~
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void strncpy_s(char*, size_t, const char*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:78:93: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
                                                                                             ^~~~~
../../Source/ThirdParty/openvr/src/vrcommon/pathtools_public.cpp: In function ‘bool Path_IsAppBundle(const string&)’:
../../Source/ThirdParty/openvr/src/vrcommon/pathtools_public.cpp:464:44: warning: unused parameter ‘sPath’ [-Wunused-parameter]
 bool Path_IsAppBundle( const std::string & sPath )
                                            ^~~~~
../../Source/ThirdParty/openvr/src/vrcommon/pathtools_public.cpp: In function ‘bool Path_WriteBinaryFile(const string&, unsigned char*, unsigned int)’:
../../Source/ThirdParty/openvr/src/vrcommon/pathtools_public.cpp:658:23: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
        return written = nSize ? true : false;
               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[137/2518] Building CXX object Source/...api.dir/vrcommon/strtools_public.cpp.o
In file included from ../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.cpp:2:0:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void wcsncpy_s(wchar_t*, size_t, const wchar_t*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:72:99: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
                                                                                                   ^~~~~
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void strncpy_s(char*, size_t, const char*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:78:93: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
                                                                                             ^~~~~
[140/2518] Building CXX object Source/...r/vrcommon/vrpathregistry_public.cpp.o
In file included from ../../Source/ThirdParty/openvr/src/vrcommon/vrpathregistry_public.cpp:7:0:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void wcsncpy_s(wchar_t*, size_t, const wchar_t*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:72:99: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
                                                                                                   ^~~~~
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h: In function ‘void strncpy_s(char*, size_t, const char*, size_t)’:
../../Source/ThirdParty/openvr/src/vrcommon/strtools_public.h:78:93: warning: unused parameter ‘count’ [-Wunused-parameter]
 inline void strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
                                                                                             ^~~~~
[149/2518] Building CXX object Source/...MakeFiles/openvr_api.dir/jsoncpp.cpp.o
../../Source/ThirdParty/openvr/src/jsoncpp.cpp:2459:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (push)
 
../../Source/ThirdParty/openvr/src/jsoncpp.cpp:2460:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4702)
 
../../Source/ThirdParty/openvr/src/jsoncpp.cpp:4029:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (pop)
 
../../Source/ThirdParty/openvr/src/jsoncpp.cpp: In member function ‘bool Json::OurReader::readToken(Json::OurReader::Token&)’:
../../Source/ThirdParty/openvr/src/jsoncpp.cpp:1430:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (features_.allowSingleQuotes_) {
     ^~
../../Source/ThirdParty/openvr/src/jsoncpp.cpp:1435:3: note: here
   case '/':
   ^~~~
Comment 1 Sergio Villar Senin 2018-01-26 00:45:34 PST
OK I'll take a look
Comment 2 Michael Catanzaro 2018-01-30 14:15:00 PST
Haven't tested, but I think something like this in Source/ThirdParty/openvr/CMakeLists.txt would do the trick:

if (COMPILER_IS_GCC_OR_CLANG)
    WEBKIT_ADD_TARGET_CXX_FLAGS(${LIBNAME} -Wno-implicit-fallthrough
                                           -Wno-parentheses
                                           -Wno-unknown-pragmas
                                           -Wno-unused-parameter
                                           -Wno-unused-variable)
endif ()

Should also remove the project() call in that file, as that's causing this warning:

CMake Warning (dev) at Source/ThirdParty/openvr/src/CMakeLists.txt:2 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
This warning is for project developers.  Use -Wno-dev to suppress it.
Comment 3 Zan Dobersek 2018-02-03 09:13:46 PST
Created attachment 333037 [details]
Patch
Comment 4 Michael Catanzaro 2018-02-03 15:38:23 PST
Comment on attachment 333037 [details]
Patch

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

> Source/ThirdParty/ChangeLog:22
> +        All changes to the OpenVR code are reflected in the separately-managed
> +        patch files kept in the patches/ directory.

Oooh, you even updated the patch file, thanks!

> Source/ThirdParty/openvr/src/CMakeLists.txt:1
> -# Project name.
> -project(openvr_api)
> +set(OPENVR_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/openvr)

Ahhh, good idea!

> Source/ThirdParty/openvr/src/CMakeLists.txt:93
> +    WEBKIT_ADD_TARGET_CXX_FLAGS(${LIBNAME} -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable)

Better style is to put each argument on a separate line, since it'll be more readable when we inevitably have to add more flags here next time we update OpenVR.
Comment 5 Zan Dobersek 2018-02-03 23:28:31 PST
Created attachment 333047 [details]
Patch for landing
Comment 6 Zan Dobersek 2018-02-04 00:17:20 PST
Comment on attachment 333047 [details]
Patch for landing

Clearing flags on attachment: 333047

Committed r228051: <https://trac.webkit.org/changeset/228051>
Comment 7 Zan Dobersek 2018-02-04 00:17:24 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Michael Catanzaro 2018-02-05 14:19:21 PST
Committed r228126: <https://trac.webkit.org/changeset/228126>