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 - compiler warnings SDL_stdinc.h (g++) [patch attached]
Summary: compiler warnings SDL_stdinc.h (g++) [patch attached]
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-03 13:57 UTC by Martin Gerhardy
Modified: 2013-04-04 11:36 UTC (History)
1 user (show)

See Also:


Attachments
fixed the warnings (1.64 KB, patch)
2013-04-03 13:57 UTC, Martin Gerhardy
Details | Diff
this time the fixed patch (1.63 KB, patch)
2013-04-04 01:57 UTC, Martin Gerhardy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.