Commit Graph
230 Commits
Author SHA1 Message Date
Vasily 14ab02f155 Remove function calls to say all vars are found 2019-01-04 16:14:47 +01:00
Vasily e7cb2d8c1a Add python build.py script
Does not work as well as the PS script, because of having to create
subprocesses and routing stdout and stderr seems to be problematic.
2019-01-04 16:13:23 +01:00
Vasily b0bce08c2d Convert win formatting script to use LLVM_LOC instead of
CLANG_FORMAT_LOC

The path to the bin dir for LLVM can be used for both clang-cl.exe and
clang-format.exe. Changing this will reduce the amount of environment
variables in play, leading to better long term quality.
2018-12-29 01:17:51 +01:00
Vasily 7449b1f1a9 Disable packaging and building installer by default
The average dev doesn't need to test out the zipping and installer
building utility. Having them package on every build is a waste of time.
2018-12-29 00:58:26 +01:00
username223 50a7486fc9 Merge pull request #13 from OpenVR-Advanced-Settings/update-dep-log
Update easylogging++ from 9.84 to 9.96.7, turn on warnings as errors for clang-msvc
2018-12-28 22:23:40 +01:00
username223 931c417331 Merge branch 'master' into update-dep-log 2018-12-28 22:17:32 +01:00
username223 cfde8ada63 Merge pull request #12 from OpenVR-Advanced-Settings/formatting
Implement clang-format and format entire src directory
2018-12-28 20:54:03 +01:00
Robin Appelman 3f0fbeb1b0 mark linux formatting scripts as executable 2018-12-28 20:42:33 +01:00
Vasily 07ca5340dd Update easylogging++ to 9.96.7, turn on /WX for clang-msvc
Updating from easylogging++ 9.89 to 9.96.7 turns it from a header only
library to one requiring a source file. It has been added to sources
near the other third party includes in the QMAKE to signify that it
isn't a first party file.

Updating easylogging++ also means that clang-msvc can compile without
any warnings, hence turning on warnings as errors for that compiler as
well, to avoid any regressions.
2018-12-28 20:18:47 +01:00
Vasily a49d889ee8 Move easylogging++ include into necessary files
logging.h previously had logic to enable debug logging even on release
builds. This logic was moved to the QMAKE file, hence the logging.h file
is no longer necessary.
2018-12-28 20:07:00 +01:00
Vasily ad07220baf Move logging defines to QMAKE instead of logging.h
Defines done outside of easylogging++.h does not work according to
official documentation
(https://github.com/zuhd-org/easyloggingpp/blob/master/README.md#configuration-macros)

"NOTE: All the macros can be defined in one of the following ways:

1. Define macros using -D option of compiler, for example in case of
g++ you will do g++ source.cpp ... -DELPP_SYSLOG -DELPP_THREAD_SAFE
... (recommended way)

2. Define macros inside "easylogging++.h" (defining macros in other
files won't work)"

Linking to this issue:
https://github.com/zuhd-org/easyloggingpp/issues/590#issuecomment-346753951

We are using the developer recommended way of defining them by command
line.

What is assumed to be the intention of enabling debug logs before
including easylogging++ never actually did anything, hence this define
is dropped. Newer versions of easylogging++ uses the macro
ELPP_DISABLE_DEBUG_LOGS to _disable_ debug logs. Leaving that macro
undefined satisfies the original intent.
2018-12-28 19:49:49 +01:00
Vasily 9519d96e93 Update easylogging license file
Originally came as LICENCE.txt (notice C instead of S in LICENSE),
renamed to better fit into the git history.
2018-12-28 19:04:59 +01:00
Vasily 7cea4f23d1 Update logging dependency from 9.84 to 9.89
This is the newest version that doesn't lead to compile errors. It has
also reduced the amount of "-Wexpansion-to-defined" errors on clang-msvc
by about 80 (from ~400 to 320).
2018-12-28 18:59:58 +01:00
Vasily 9d9d3c8c7d Fix link errors in readmes 2018-12-28 15:57:32 +01:00
Vasily 4e05e66154 Update readme and building_for_windows
Adds links to programs needed in the windows file and links to
CONTRIBUTING.md for both Windows and Linux.
2018-12-28 15:53:49 +01:00
Vasily 3a6c8f5b11 Add documentation for use of clang-format
A CONTRIBUTING file is considered special by Github, being automatically
linked to whenever an attempted pull request is made. Writing the
formatting changes along with how to submit bug reports might seem
fractured, but the special status of the CONTRIBUTING file means that
users are likely to find it. Additionally, links will be added to the
Readme and building_on_windows files.
2018-12-28 15:53:49 +01:00
Vasily 1e3d3b3aed Add additional error handling to verification scripts 2018-12-28 15:53:41 +01:00
Vasily e0de89092e Add Travis CI badge to readme
Individual badges moved to own lines for readability.
2018-12-28 03:35:07 +01:00
Vasily 51057c1d79 Format every single file using .clang-format 2018-12-28 03:06:42 +01:00
Vasily 89c02642fc Fix switch in .clang-format that sorted includes.
This leads to a ton of compile errors. Better just leave it off.
2018-12-28 03:03:16 +01:00
Vasily 86a0dae70b Add verification scripts for clang-format
The scripts are very light on error handling and verification, mostly
intended just to debug if a CI server fails on formatting reasons.
2018-12-28 03:01:45 +01:00
Vasily 7c5146b05e Make .travis.yml and .appveyor.yml work, rename appveyor.yml
The appveyor script can not use a single quoted double quotes string,
like '"C:\Spaces are trouble\"', hence the solution of defining an
environment variable.

appveyor.yml has been renamed to .appveyor.yml to keep consistent with
.travis.yml and to be default hidden.
2018-12-28 01:28:26 +01:00
Vasily d58eb66e80 Update travis.yml
This commit should fail because nothing has been formatted yet.
2018-12-28 00:57:54 +01:00
Vasily 322ffb7dbb Update appveyor script
This commit should fail CI on appveyor, since nothing has been formatted
yet.
2018-12-28 00:49:51 +01:00
Vasily 4446af2a06 Add linux script
Not a lot of output compared to windows. It is assumed that linux users
have clang-format in the path.
2018-12-28 00:24:40 +01:00
Vasily c33e8f76e7 Add windows formatting script
Done in batch script because Powershell requires execution policy to be
changed to run scripts. Therefore batch files are considered to have a
lower barrier for entry.
2018-12-28 00:23:14 +01:00
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