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 2556 - add compilation flag -Wshadow
Summary: add compilation flag -Wshadow
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-20 06:10 UTC by Sylvain
Modified: 2014-06-25 07:43 UTC (History)
0 users

See Also:


Attachments
patch 1 (5.72 KB, text/plain)
2014-06-22 20:18 UTC, Sylvain
Details
full patch for shadow (15.71 KB, text/plain)
2014-06-22 20:41 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2014-05-20 06:10:44 UTC
Hello,

It seems the flag "-Wshadow" is used for the compilation, it would be nice to add it. There are a few variables that could therefore double-checked !

(sorry no patch...)

Cheers,

Sylvain
Comment 1 Sam Lantinga 2014-06-22 18:03:21 UTC
I added -Wshadow and then turned it off again because of massive variable shadowing in the blit macros.
https://hg.libsdl.org/SDL/rev/c23ffe72934c

Anyone can feel free to reopen this if you want to go through that code and fix it. Just uncomment CheckWarnShadow in configure.in if you want to try this.
Comment 2 Sylvain 2014-06-22 18:13:13 UTC
Thanks, I can have a look at that :)
Comment 3 Sam Lantinga 2014-06-22 18:23:22 UTC
Thanks. :)
Comment 4 Sylvain 2014-06-22 20:18:49 UTC
Created attachment 1701 [details]
patch 1

here's a first patch with a few shadowed variables (no blit and duff loop stuff).
Comment 5 Sylvain 2014-06-22 20:41:42 UTC
Created attachment 1702 [details]
full patch for shadow

here's the full patch for Blit + RLE.
It compiles.. but I am not sure that RLE get tested.
Comment 6 Sylvain 2014-06-22 20:43:01 UTC
It remains a shadow variable on SDL_video.c : static _this  + _this parameter, but It seems this is on purpose.
Comment 7 Sylvain 2014-06-24 20:58:41 UTC
since there are patchs, I just reopen it ...
Comment 8 Sam Lantinga 2014-06-25 07:43:42 UTC
Thanks!
https://hg.libsdl.org/SDL/rev/dfb6f8611ebe