The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL2 strip question and a minor patch
ab396356_2


Joined: 04 Nov 2016
Posts: 1
Location: temporary account, see @ab396356
Using MSYS2 20160205 and TDM-GCC 5.1.0 on Windows 7 64-bit to build SDL2 version 2.0.5.

I noticed that there is no install-strip target and as such the resulting library SDL2.dll is not stripped after installing. Is there a special target or configuration option to strip the resulting .DLL file automatically? Such that one needn't manually use the strip utility as in:

Code:
$ pwd; ls; du -b SDL2.dll
/usr/local/bin
SDL2.dll  sdl2-config
6994735 SDL2.dll

$ strip SDL2.dll; du -b SDL2.dll
1193472 SDL2.dll


A different subject: by configuring warnings to be "-Wall -Wextra" a lot of "unused variable" and "signed/unsigned comparison" warnings have been uncovered. The full build log is linked below, and I've provided a patch for SDL2 version 2.0.5 to fix the warnings on Windows (only).

Build Log
Warning Fix Patch

I have tried doing the same on Linux but I gave up after SDL2 stubbornly refused to build due to the error "ISO C90 forbids mixed declarations and code" for the updated file SDL_audiotypecvt.c even though I was configuring SDL2 with CFLAGS="-std=c99" or CFLAGS="-std=gnu99".

On a pedantic note, I've seen that some identifier names start with underscore and uppercase letter (e.g. "_THIS"). This shouldn't be done, as the C99 standard states that they are reserved:

ISO/IEC 9899:TC3 7.1.3/1 wrote:
"All identifiers that begin with an underscore and either an uppercase letter or another
underscore are always reserved for any use."

"All identifiers that begin with an underscore are always reserved for use as identifiers
with file scope in both the ordinary and tag name spaces."


Usually I enable "-Wall -Wextra -pedantic" for my own programs but I've dropped "-pedantic" for SDL2 after seeing too many warnings for unfixable weirdness such as arrays longer than 4095 bytes and object pointers converted to function pointers.

If you decide that future versions of SDL2 should have stricter (perhaps C99 standard compliant) code that will compile cleanly even with pedantic warnings, I am willing to help by providing new patches for the currently published version. Those patches however would be different in nature from the above one ("Warning Fix Patch") in that they'd change the ABI and API by using more specialized types instead of int, among other things.