Commit Graph

20 Commits (4e07d4722d61c65e8fc4d4685e3a0861eea5d15b)

Author SHA1 Message Date
Cameron Gutman a60986caa8 Correct default structure packing on Windows ARM64
See issue #5454 for details
2022-03-27 19:03:54 -05:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Ozkan Sezer acb602d607 minor style adjustment 2021-11-12 07:28:00 +03:00
Misa 3bf7994fe2 Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-12 07:26:14 +03:00
Sam Lantinga abc12a832c Revert "Add and use `SDL_FALLTHROUGH` for fallthroughs"
This reverts commit 66a08aa391.

This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
2021-11-11 15:58:44 -08:00
Misa 66a08aa391 Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-11 07:23:25 -08:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Ozkan Sezer 250a055727 fix bug #5384 -- define DLL_EXPORT in DLL builds and adjust begin_code.h 2020-12-09 12:01:10 +03:00
Mikhail Paulyshka 146d9b8201 win32: fix symbols leakage for static libraries 2017-09-24 14:32:30 +03:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga 9891c31ba0 Fixed bug 4641 - clang and clang-cl builds on windows create -Wpragma-pack warnings 2019-06-10 08:46:20 -07:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga f33377802a Fixed bug 3807 - Remove restriction from DECLSPEC macro for OS/2
Ozkan Sezer

The following patch removes the unnecessary / wrong
Watcom restriction from the DECLSPEC macro for OS/2.
2017-09-09 07:42:29 -07:00
Sam Lantinga c350d91a6a Fixed bug 3752 - minor os2 defines
Ozkan Sezer

Attached three patches, so these minor os/2 bits get registered mainstream:

1. SDL_syswm.h: add SDL_SYSWM_OS2 to SDL_SYSWM_TYPE enum
2. SDL_platform.h: recognize __EMX__ too as __OS2__
3. begin_code.h: set SDLCALL as _System for OS/2.
2017-08-14 10:15:38 -07:00
Ryan C. Gordon d526b8a1e9 Some patches to make SDL compile with armcc (ARM's C compiler). 2017-03-02 13:33:04 -05:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 818d1d3e80 Fixed bug 1646 - Warnings from clang with -Weverything 2016-11-15 01:30:08 -08:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00