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

Summary: add compilation flag -Wshadow
Product: SDL Reporter: Sylvain <sylvain.becker>
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: patch 1
full patch for shadow

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