Commit Graph
1004 Commits
Author SHA1 Message Date
Vasily f3b66784d6 Add .clang-format file
This is an arbitrarily picked .clang-format.
2018-12-28 00:03:27 +01:00
Vasily b338872af3 Add python clang-format wrapper
Original found here: https://github.com/Sarcasm/run-clang-format

Licensed under MIT.
2018-12-28 00:03:20 +01:00
username223 93fd5060b1 Merge pull request #11 from OpenVR-Advanced-Settings/eliminate-warnings
Add compiler switches for treating warnings as errors, fix current warnings
2018-12-27 20:38:12 +01:00
Vasily f1f39ac1a8 Add /WX switches for MSVC compilers, except clang-msvc
Clang-msvc has problems with around 400 "-Wexpansion-to-defined" errors
in easylogging++.h. No flags seem to be able to disable this error.
Clang-cl is generally in an awkward halfway place between clang and
msvc.

Msvc has problems with C4127 "conditional expression is constant" in the
"qvarlengtharray.h", hence it being disabled with /wd4127.

Neither msvc* compiler has proper support for disabling errors in
specific files. It's either QMAKE magic or waiting for proper support.
2018-12-27 20:09:48 +01:00
Vasily e8cda901d1 Rename local var that shadows member var
Notice that the class has an identical var that is used in several
places. It is unknown if the original programmer intended to use the
member var in this function, but what is actually being done is a new
var being created, changed and returned. This may not respect the
original intention, but it does preserve the original mechanics.
2018-12-27 18:42:29 +01:00
Vasily b097908b12 Rename parameters shadowing class members
Parameters with the same name as class members are ripe for introducing
bugs. The fact that the "this->" syntax is optional creates confusion
for maintaining programmers who can only guess at the intention.
2018-12-27 18:27:27 +01:00
Vasily 412e56fa11 Add switches for msvc-clang
The clang frontend for MSVC does not allow the same type of switches
that regular clang does, therefore we need logic to gate off msvc-clang.
2018-12-27 16:27:31 +01:00
Vasily f42c481308 Add brackets around intialization of 2D array inside struct
2 brackets are necessary because it's initialization of a struct,
intializing an 3 member array of 4 floats.
2018-12-27 14:29:22 +01:00
Vasily e7e7272d52 Fix memory leaks as result of missing delete[]
The delete keyword only calls a single destructor, delete[] calls as
many as there are members in the array.
2018-12-27 14:23:54 +01:00
Vasily d9a4da5f5d Change C style cast to reinterpret_cast
static_cast won't cast between pointer types, reinterpret_cast will.
2018-12-27 14:18:03 +01:00
Vasily b452e68456 Fix minor memory leaks
The delete keyword only calls a single destructor, the delete[] keyword
calls as many destructors as there are members of the array.
2018-12-27 14:14:49 +01:00
Vasily 450bf91db6 Resolve implicit unsigned/signed casts 2018-12-27 14:13:27 +01:00
Vasily 6c4541018d Change NULL to nullptr 2018-12-27 14:05:37 +01:00
Vasily 0d6917566e Add clang switch to ignore third party warnings
The --system-header-prefix=third-party treats all includes with a path
matching third-party as system files, meaning they won't show warnings.
2018-12-27 14:04:14 +01:00
Vasily f32c91fe03 Fix GCC warning about unused value
Casting to void should shut up GCC about

error: statement has no effect [-Werror=unused-value]

static_cast<void>() is possible for all current types. Supposedly an old
C style cast could also be used, but they should not be used in modern
C++ code.
2018-12-27 13:09:17 +01:00
Vasily 9a2c388a1c Solve initialization bug in MOveCenterTabController
GCC gave error

../src/tabcontrollers/MoveCenterTabController.cpp:57:67: error:
operation on
‘((advsettings::MoveCenterTabController*)this)->advsettings::MoveCenterTabController::lastMoveButtonClick[0]’
may be undefined [-Werror=sequence-point]

Because assigning a value to itself twice is undefined behavior. It is
highly likely that intended behavior was to initialize both array
members to the same value at once.
2018-12-27 12:14:07 +01:00
Vasily e54f244508 Fix warnings in AudioTabController
Mostly casts and unsigned to signed comparisons.

Testing to ensure that the int isn't below 0. If it is, it can't be used
in the array later anyway. After we're sure it isn't below 0 it's safe
to static_cast<size_t>().
2018-12-27 01:55:49 +01:00
Vasily f4feafaa03 Add parens around statement to banish warning 2018-12-27 01:26:13 +01:00
Vasily 4904ccaa35 Move variables to .cpp file to prevent unused var warning message 2018-12-27 01:17:02 +01:00
Vasily 5252efcd59 Merge branch 'master' into eliminate-warnings 2018-12-27 01:00:31 +01:00
Vasily 087d242664 Add compiler switches for warnings as errors
Currently with /W3 on MSVC there are no warnings. Clang and g++ are not
tested.

The "QMAKE_CFLAGS_WARN_ON -= -W3" and "QMAKE_CXXFLAGS_WARN_ON -= -W3"
are necessary because if they are not removed in the config, the
compiler will give D9025: overriding '/W4' with '/W3' error warnings and
not actually use /W4.
2018-12-27 00:58:28 +01:00
Vasily 629c956618 Change variable being shadowed
apperror was shadowing another variable in the scope outside of the if
statement, leading to a warning.

Adding an underscore changes the var name without changing the meaning.
In the future a different structure should probably be chosen for the
statements.
2018-12-27 00:29:08 +01:00
Vasily 6d3b5fdf63 Remove warnings for unreferenced parameters
The warnings in dummy functions are preventing the project from being
compiled with warnings as errors.

There were two options:

* Using a define to create a noop (chosen option).

* Commenting out the variable name, leaving only the type.

The first option was chosen because the second option would leave out
information from the IDE and compiler, while the first option wouldn't.

The intent is also clearer with the first option, otherwise it would
likely be necessary to leave comments with every single parameter that
was commented out.
2018-12-26 23:01:11 +01:00
Vasily 1a043b6672 Remove code path that would never be executed 2018-12-26 22:33:26 +01:00
Robin Appelman acec93f624 Merge pull request #10 from OpenVR-Advanced-Settings/new-windows-build
Add new windows build scripts
2018-12-26 22:32:35 +01:00
Vasily 62489ed642 Move global level strings into scope of main 2018-12-26 22:32:21 +01:00
Vasily b5877cd4e7 Update documentation for building on windows 2018-12-26 22:08:45 +01:00
Vasily 2aa32bafad Change variable expansion in build scripts
Currently the variable expansion sometimes doesn't work when done over
two variables. Inlining the ~dp0 call along with \..\..\ seems to work.

Testing leads me to believe that the Windows command prompt caches
things in a weird way.
2018-12-26 21:58:03 +01:00
Vasily 759bd859bb Merge remote-tracking branch 'origin/master' into new-windows-build 2018-12-26 20:37:10 +01:00
Vasily de8dffe40f Add extra checks for environment vars 2018-12-26 20:23:16 +01:00
Vasily 8d0277f6cf Add quotes to all env vars in appveyor 2018-12-26 20:11:02 +01:00
Vasily fc103633fe Update package script to consider path vars 2018-12-26 20:04:55 +01:00
Vasily 2085d0716b Update appveyor, .gitignore and master build script 2018-12-26 19:38:50 +01:00
username223 afd79cd3e4 Merge pull request #9 from OpenVR-Advanced-Settings/keyboard-alt-tab
Add option to send Alt-Tab as keyboard input
2018-12-26 18:34:11 +01:00
Vasily 43eafba7a7 Add error handling to master 2018-12-26 18:21:11 +01:00
Vasily eee7148c00 New build_windows.cmd
Change names of build scripts
2018-12-26 18:21:02 +01:00
Vasily 8bec43d01e Add new build scripts for windows
The old build scripts used hard coded directory paths, didn't check if
the paths actually existed and didn't differentiate between compiling,
deploying libraries and packaging for release.

The new build scripts are split into three different files. They are all
longer than the old build scripts, but most of the extra lines are
error checking, which the old one lacked.

It was considered writing the build scripts in another language like
Python or Powershell, but the relatively small size of the project and
unlikelihood of the build systems needing to grow massively means that a
very simple imperative language like the Microsoft scripting language is
fine.
2018-12-26 18:10:10 +01:00
ykeara 18d9d7b67e Merge branch 'master' into keyboard-alt-tab 2018-12-26 11:03:27 -06:00
ykeara 46c547b93c Merge pull request #8 from OpenVR-Advanced-Settings/require-56
specify dependency on qt >=5.6
2018-12-26 11:03:05 -06:00
Robin Appelman 8e2ca3602a Add option to send Alt-Tab as keyboard input 2018-12-26 16:32:38 +01:00
Robin Appelman c57b9bc62d specify dependency on qt >5.6 2018-12-26 15:26:59 +01:00
Robin Appelman 192e315f9f add qtcreator's .pro.user.* to gitignore 2018-12-26 15:10:03 +01:00
ykeara 835c51e937 Merge pull request #7 from OpenVR-Advanced-Settings/travis-ci
add travis config for linux ci build
2018-12-25 22:41:20 -06:00
Robin Appelman f383fe081e switch to cmath and std::isnan 2018-12-26 02:09:50 +01:00
Robin Appelman 32fd633588 use kubuntu backports in travis for qt 5.6 2018-12-26 01:56:33 +01:00
Robin Appelman d8044803c3 specify c++11 2018-12-26 01:55:58 +01:00
Robin Appelman 1e7f2a5bad add travis config for linux ci build 2018-12-26 01:35:40 +01:00
username223 940355c168 Merge pull request #5 from OpenVR-Advanced-Settings/cleanup-pro
cleanup .pro file
2018-12-26 00:30:15 +01:00
username223 c3d1ba3e24 Merge branch 'master' into cleanup-pro 2018-12-26 00:24:05 +01:00
Robin Appelman 1df8bd88ae Merge pull request #6 from OpenVR-Advanced-Settings/improve-docs
Add table of contents to readme, improve docs for building on windows and command line args
2018-12-25 22:25:17 +01:00