We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1785

Summary: compiler warnings SDL_stdinc.h (g++) [patch attached]
Product: SDL Reporter: Martin Gerhardy <martin.gerhardy>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: fixed the warnings
this time the fixed patch

Description Martin Gerhardy 2013-04-03 13:57:08 UTC
attached is a patch that should fix the issues - i'm not sure whether there are any #defines for the const_cast.
Comment 1 Martin Gerhardy 2013-04-03 13:57:34 UTC
Created attachment 1096 [details]
fixed the warnings
Comment 2 Philipp Wiesemann 2013-04-03 15:43:11 UTC
(In reply to comment #1)
> Created attachment 1096 [details]
> fixed the warnings

The patch has a spelling mistake: "__cpluscplus" needs to be "__cplusplus".
Comment 3 Ryan C. Gordon 2013-04-03 15:54:23 UTC
Is there a value to using const_cast instead of just casting it to (char*) ?

--ryan.
Comment 4 Martin Gerhardy 2013-04-04 01:54:11 UTC
whenever one includes SDL.h with c++ you get the following warnings:
In file included from /usr/include/SDL2/SDL_main.h:25:0,
                 from /usr/include/SDL2/SDL.h:65,
                 from src/common/File.h:8,
                 from src/common/File.cpp:1:
/usr/include/SDL2/SDL_stdinc.h: In function 'char* SDL_strchr_inline(const char*, int)':
/usr/include/SDL2/SDL_stdinc.h:506:95: warning: cast from type 'const char*' to type 'char*' casts away qualifiers [-Wcast-qual]
/usr/include/SDL2/SDL_stdinc.h: In function 'char* SDL_strrchr_inline(const char*, int)':
/usr/include/SDL2/SDL_stdinc.h:515:97: warning: cast from type 'const char*' to type 'char*' casts away qualifiers [-Wcast-qual]
/usr/include/SDL2/SDL_stdinc.h: In function 'char* SDL_strstr_inline(const char*, const char*)':
/usr/include/SDL2/SDL_stdinc.h:524:123: warning: cast from type 'const char*' to type 'char*' casts away qualifiers [-Wcast-qual]


There is another warning about the qsort stuff - it should not have a return value. It's also included in the patch

And sorry for the typo.
Comment 5 Martin Gerhardy 2013-04-04 01:57:34 UTC
Created attachment 1097 [details]
this time the fixed patch
Comment 6 Ryan C. Gordon 2013-04-04 11:36:33 UTC
This is now hg changeset c1563f514b5b, thanks!

--ryan.