21 Commits

Author SHA1 Message Date
Chris Thrasher
c91973fdd1
Only enable compiler warnings in developer builds
Compiler warnings are a tool we enable as developers to detect
issues with our source code that go beyond the basic requirements
of compiling C++ code. For example, many implicit conversions are
perfectly correct, and defined behavior in C++ but we choose to
disallow them with -Wconversion. This is something only us devs
have to care about. Someone using SFML wants the library to work
well but does not need to concern themselves with such low level
details about its implementation.

By disabling warnings in non-developer builds, we ensure that non-
developer users of SFML are not going to see console noise due to
warnings and it prevents issues like GCC's bug 82952 which causes
compilation to halt indefitely due to a bug in how a compiler
warning is implemented.

This also improves compatibility with older compilers. If we enable
warnings in all builds no matter what, we have to protect against
compilers we don't expect. Perhaps someone uses an older version
of GCC that we haven't tested with. This compiler is perfectly fine
compiling our C++ but we happen to use a warning flag it does not
recognize so the build fails. This is not a good reason for a
build to fail but nevertheless it's something we have to deal with
so long as we always enable warnings.

SFML_WARNINGS_AS_ERRORS is now named somewhat incorrectly but I
retained the name for compatibility's sake. We can rename it to
SFML_ENABLE_WARNINGS or something similar in SFML 4.
2025-02-13 11:37:37 -05:00
Chris Thrasher
ab109cd3cd Use ON and OFF for CMake booleans
CMake supports a number of strings for truthy and falsey values.
ON/OFF and TRUE/FALSE are the most popular but 1/0 is also supported.
This is mostly a style choice but I'm inclined to believe that ON/OFF
is the most popular option and I'm generally in favor of style
choices that better align with the community at large.
2024-09-11 14:36:13 -06:00
Chris Thrasher
4a463ec136 Throw custom sf::Exception type 2024-08-25 12:17:49 -06:00
Chris Thrasher
0745ea97e0 Disable warnings as errors by default
This is not the best default value because it imposes additional
requirements on user builds that are not strictly necessary. This
has caused many complaints in the past as people encounter build
failures that are merely due to warnings and not hard compiler
errors.

Changing this default value emakes it more likely that someone trying
to use SFML can use it without issue.
2023-09-07 14:16:51 -06:00
Chris Thrasher
659eca2a62 Apply SFML_ prefix to compiler warning option 2023-07-16 17:20:18 -06:00
Chris Thrasher
75642ef7aa Enable warnings as errors for clang-cl.exe 2022-12-11 13:51:15 -07:00
Chris Thrasher
e54bf87e9b Enable MSVC deprecation warning 2022-12-11 13:51:15 -07:00
Chris Thrasher
a5dbe59f07
Merge branch '2.6.x' 2022-10-13 14:33:11 -06:00
Chris Thrasher
aa82ea132b Set warnings with target_compile_options
The use of target_compile_options makes it easy to append warnings
to a target. The use of generator expressions also more succinctly
handles a few edge cases for compiler bugs and platform-specific
oddities.

This should be easy to read and maintain than the variable-based
solution it replaces.
2022-08-14 14:00:00 +08:00
Chris Thrasher
142ccf57bd Enable compiler warnings for Android 2022-08-12 18:01:36 +02:00
Bambo-Borris
12c091e0ce Disable /WX for clang-cl 2022-06-12 17:40:01 +02:00
Chris Thrasher
8a4563361f Set compiler warnings on a per-target, not per-file basis
No 1st party SFML targets contain 3rd party source code so it's
safe and correct to apply warnings to the entire target.
2022-05-02 08:39:02 +02:00
Chris Thrasher
4b93727413 Enable MSVC standards conformance 2022-04-19 08:33:27 +02:00
Lukas Dürrenberger
3cd45a283b Merge branch '2.6.x' into feature/backmerge 2021-12-20 13:44:56 +01:00
Pawel Paruzel
c824d3d57a Fix all macOS clang warnings
Co-authored-by: binary1248 <binary1248@hotmail.com>
2021-12-20 00:10:55 +01:00
Pawel Paruzel
aae00e9002 Fix cmake -DWARNINGS_AS_ERRORS=1 for clang 2021-12-20 00:10:55 +01:00
Vittorio Romeo
d12a2cd319 Use 'override' whenever possible instead of 'virtual' 2021-12-09 09:07:03 +01:00
Vittorio Romeo
9a0cc4b7dc Use alias declarations instead of 'typedef' 2021-12-08 17:58:13 +00:00
Vittorio Romeo
dd14d7c57f Use '[[fallthrough]]' attribute and enable relevant warning 2021-12-04 12:42:09 +01:00
Vittorio Romeo
6cf124db66 Fix remaining warnings
- Fixes in examples
- Fixes across all the modules
2021-11-30 11:25:58 +01:00
binary1248
a759ccd5db Enable compiler warnings. 2021-11-30 11:25:58 +01:00