Commit Graph

3442 Commits

Author SHA1 Message Date
Chris Thrasher
bb1a465e50 Add cppcoreguidelines-pro-type-member-init clang-tidy check
This marks another good step towards systematically rooting out
undefined behavior in the form of reading uninitialized memory.
2023-10-17 21:41:36 -05:00
Chris Thrasher
63eff96581 Add cppcoreguidelines clang-tidy checks
The following checks have been added:

    cppcoreguidelines-avoid-capturing-lambda-coroutines
    cppcoreguidelines-avoid-goto
    cppcoreguidelines-avoid-reference-coroutine-parameters
    cppcoreguidelines-c-copy-assignment-signature
    cppcoreguidelines-explicit-virtual-functions
    cppcoreguidelines-interfaces-global-init
    cppcoreguidelines-misleading-capture-default-by-value
    cppcoreguidelines-missing-std-forward
    cppcoreguidelines-noexcept-destructor
    cppcoreguidelines-noexcept-move-operations
    cppcoreguidelines-noexcept-swap
    cppcoreguidelines-pro-type-cstyle-cast
    cppcoreguidelines-slicing
    cppcoreguidelines-use-default-member-init
    cppcoreguidelines-virtual-class-destructor
2023-10-17 12:36:49 -05:00
Chris Thrasher
0de21b8ce3 Promote Windows Unity build jobs to main CI matrix 2023-10-16 13:45:01 -05:00
Chris Thrasher
4ff0dabba3 Promote Windows OpenGL ES jobs to main CI matrix 2023-10-16 13:45:01 -05:00
Chris Thrasher
12439919c7 Promote Linux OpenGL ES jobs to main CI matrix 2023-10-16 13:45:01 -05:00
Chris Thrasher
bdd6ad5145 Promote DRM jobs to main CI matrix 2023-10-16 13:45:01 -05:00
Bruno Van de Velde
13c8a1de4e Fixed texture being upside down on Android when copying the texture of a RenderTexture 2023-10-12 15:22:37 -05:00
Bruno Van de Velde
67c9019eda Fixed texture being upside down on Android when copying the texture of a RenderTexture 2023-10-09 09:59:33 -06:00
Chris Thrasher
fb88d1a8b3 Set Bash as the default shell 2023-10-09 00:22:34 -06:00
Chris Thrasher
f98ff0d26a Assert against division by zero in public APIs
Yet another class of UB we can eliminate in debug builds.
2023-10-08 20:02:38 -06:00
binary1248
25bb6637eb Cache packages downloaded when GitHub actions workflow is run. 2023-10-08 16:48:53 -06:00
binary1248
90ebf68ba3 Added GitHub Actions jobs to build with OpenGL ES on Linux GCC. 2023-10-08 12:13:41 -06:00
binary1248
fe778028a2 Fixed RenderTarget tracking not being notified to update its active target when an FBO RenderTexture is display()ed. Fixes #2630 2023-10-08 11:37:18 -06:00
Chris Thrasher
c0061797e3 Add more tests for sf::Window 2023-10-05 17:41:29 -06:00
Chris Thrasher
e638d7a5e9 Simplify how tests are automatically re-ran in CI
The flakiness is theoretically limited to Linux where we have to
use xvfb-run in CI. Because the tests are ran on Linux via ctest
we can more easily use CTest's built-in support for rerunning
failed tests. We have yet to actually observe this flakiness after
the other changes added in #2474 so it's possible the flakiness
has been entirely addressed.

While I was at it I de-duplicated some code for printing OpenGL
information.
2023-10-05 16:56:05 -06:00
Chris Thrasher
b856d806be Improve sf::FileInputStream test coverage 2023-10-05 16:46:31 -06:00
Bruno Van de Velde
46ba176463 Fixed compiling on Linux with SFML_OPENGL_ES 2023-10-05 14:11:31 -06:00
binary1248
e1fe3fdb06 Manually install MinGW when running GitHub Actions workflows. 2023-10-04 18:31:38 +02:00
binary1248
75be07fa34 Fix CMake minimum required version being too low to support specifying SYSTEM in target_include_directories for Visual Studio generators. 2023-10-03 21:04:47 -06:00
Chris Thrasher
793ee75873 Only install MinGW when necessary
Installing MinGW 11 takes way too long to tolerate doing this in
all Windows jobs.
2023-10-03 02:42:22 +02:00
Chris Thrasher
9d1d9cde33 Remove Intel oneAPI CI jobs
These started spontaneously failing due to some Debian package
repository key issues.

https://github.com/SFML/SFML/actions/runs/6365368228/job/17282319034#step:6:40
2023-10-01 21:39:58 +02:00
Chris Thrasher
cc147e5827 Install an older version of MinGW
Version 12 changes to URCT instead of MSVCRT which causes linker
issues with all the prebuilt MinGW binaries. This is still a liability
that will have to eventually be fixed.
2023-09-30 18:50:10 -06:00
Chris Thrasher
732115820b Revert "Disable MinGW jobs until linker errors are addressed"
This reverts commit 3acb69e347.
2023-09-30 18:50:10 -06:00
Chris Thrasher
cbec344876 Use one InputImpl.hpp header for all implementations
There were 6 copies of InputImpl.hpp for Windows, macOS, Linux,
Linux DRM, iOS, and Android. All but Windows and Linux DRM were
identical so there's already an easy opportunity for consolidation.

The Windows header included some additional private static functions
and data. An equivalent way of expressing this is via more data and
functions instead the anonymous namespace of Win32/InputImpl.cpp so
that's what I did. To fix some issues with functions being used
before they're defined I moved number of functions into the anonymous
namespace of that file which resulted in adding `sf::` in lots of places.

InputImplUDev.hpp used by the DRM backend was trickier because includes
WindowImplDRM as a friend. This creates a weird dependency graph where a
distant class can call private functions that mutate private state. I
kept the definitions of those functions inside DRM/InputImpl.cpp while
moving their declaration to WindowImplDRM.cpp which is the only file
where they're used. This is a bit odd but it avoids using the
preprocessor and ensures that only the file that needs these functions
can call them.

In the end I was able to delete all 6 separate copies of InputImpl.hpp
and consolidate them into src/SFML/Window/InputImpl.hpp saving nearly
1,000 lines of code.

Because `sf::priv::InputImpl` is merely a set of static functions I
converted this class to a simple namespace. The use of a namespace is
what ultimately allowed me to untangle the DRM functions that were not
present in other implementations
2023-09-30 14:16:12 -06:00
Chris Thrasher
56784e198b Remove header include cycles 2023-09-29 15:55:39 -06:00
Chris Thrasher
1e4aed8700 Fix clang-tidy readability-container-size-empty warnings 2023-09-29 15:55:39 -06:00
Chris Thrasher
10d8f5bf1e Silence new clang-tidy-17 checks 2023-09-29 15:55:39 -06:00
Chris Thrasher
dbb87db026 Add more tests for sf::Text 2023-09-28 12:41:29 -06:00
Chris Thrasher
3f6403e279 Stop manipulating standard library flags for macOS builds 2023-09-25 22:41:36 -06:00
Chris Thrasher
52de41294e Assert against invalid function name
In testing I tried passing `nullptr` to this function which caused
a segfault on Linux. If we know that's an invalid input then lets
assert against it.
2023-09-24 21:12:18 -06:00
Chris Thrasher
3750074238 Add tests for sf::Vulkan 2023-09-24 21:12:18 -06:00
Chris Thrasher
f40d5ac21d Add tests for sf::Joystick 2023-09-24 20:58:41 -06:00
Chris Thrasher
856a81f62b Assert against out of bounds array access in sf::Joystick
sf::JoystickManager is a private type but the sf::Joystick API calls
into it so those asserts are still prone to fail due to incorrect
user input.

Yay for catching more UB :)
2023-09-24 20:58:41 -06:00
Chris Thrasher
d6c18af926 Use cross-platform threading library target 2023-09-24 20:57:33 -06:00
Chris Thrasher
3acb69e347 Disable MinGW jobs until linker errors are addressed
See https://github.com/SFML/SFML/issues/2700
2023-09-22 14:46:27 -06:00
Chris Thrasher
739129d009 Install Ninja in CI
https://github.com/actions/runner-images/issues/8343#issuecomment-1727810519

Ninja's presence in the Windows images was due to it being a
transitive dependency of another packages. It was never guaranteed
to be present. The actions/runner-images devs do not plan on adding
it so we're forced to install it ourselves.
2023-09-22 14:46:27 -06:00
Chris Thrasher
ff5eaca6a2 Add more tests for sf::VideoMode 2023-09-19 13:43:28 -06:00
Chris Thrasher
3a0d074b2f Remove trailing whitespace
Some of these files either aren't processed by clang-format or the
trailing whitespace existed within blocks of code where we disabled
clang-format.
2023-09-19 13:30:27 -06:00
Chris Thrasher
910514871e Remove unnecessary CI step
clang-format is already installed in GitHub's Ubuntu image
2023-09-18 09:06:35 -06:00
Chris Thrasher
1b257c8ea8 Fix nested namespace name 2023-09-18 09:06:18 -06:00
Chris Thrasher
6b503a726d Use sf::String::toUtf8() 2023-09-17 17:18:14 -06:00
Chris Thrasher
9dc2e541e8 Add clang-tidy modernize-return-braced-init-list check 2023-09-17 15:47:33 -06:00
Chris Thrasher
434effd6a1 Fix awkward error phrasing 2023-09-17 13:21:40 -06:00
Chris Thrasher
f9e6f673dd Fix references to sf::WindowBase::setMouseCursor
This function does exist in sf::Window via inheritence but it's
more accurate to refer to the base implementation in sf::WindowBase
2023-09-17 13:01:37 -06:00
Chris Thrasher
d56e1838a0 Shallow clone Catch2
This takes a 4 second configuration time for the entire project with
examples and tests and turns that into 3! Whopping 25% reduction in
configuration time. This effect is likely to be even larger on machines
without exceptionally good internet connections.

Before:
  $ hyperfine 'rm -rf build && cmake --preset dev'
  Benchmark 1: rm -rf build && cmake --preset dev
    Time (mean ± σ):      4.076 s ±  0.130 s    [User: 2.148 s, System: 1.376 s]
    Range (min … max):    3.963 s …  4.321 s    10 runs

After:
  $ hyperfine 'rm -rf build && cmake --preset dev'
  Benchmark 1: rm -rf build && cmake --preset dev
    Time (mean ± σ):      3.007 s ±  0.313 s    [User: 1.061 s, System: 1.160 s]
    Range (min … max):    2.783 s …  3.805 s    10 runs

Co-authored-by: binary1248 <binary1248@hotmail.com>
2023-09-15 16:07:52 -06:00
Chris Thrasher
f6f95b03a5 Assert in-bounds access when using operator[]
Out of bounds array access is undefined behavior so let's be sure
to catch potential UB in debug builds. It's too easy to accidentally
provide an invalid index to one of these public APIs.
2023-09-13 16:48:50 -06:00
Chris Thrasher
d6079ce526 Reenable sf::Cursor tests
A fun thing about runDisplayTests() is that it means that the tests
won't get run in CI on the DRM code. Technically you can run the
display tests locally when buidling with DRM so these tests will
still fail under those circumstances. Regardless I think this is a
net positive to run the tests in CI.
2023-09-13 16:19:18 -06:00
Vittorio Romeo
5cfbf912c7 Do not ignore '[[nodiscard]]` functions in example code 2023-09-13 16:06:23 -06:00
Chris Thrasher
a71d6bc078 Revert "Disable faulty Windows Clang job"
This reverts commit bbb6f60dda.
2023-09-09 00:17:08 -06:00
Chris Thrasher
7cd1ce1385 Add changelog for 2.6.1 2023-09-07 16:13:04 -06:00