On Thu, Nov 7, 2013 at 11:43 AM, David Rowley <dgrowleyml@gmail.com> wrote: > Attached is a small patch which fixes the unused variable warning in the > visual studios build. Seems like VS does not support > __attribute__((unused)) but looks like all other places we must assign to > the variable.
The reason that we don't see more warnings for this is that it seems in all other places where we have used PG_USED_FOR_ASSERTS_ONLY, the variable is getting assigned to every time, though it will only be when compiled in debug that the variable is checked. It seems microsoft decided to disable warnings for assigned but not used for pretty much this reason.
"Microsoft explain that it's because they had lots of complaints from people who were assigning variables purely so they could see what a method call returned during debugging, and found the warning irritating:"
So I guess fixing up PG_USED_FOR_ASSERTS_ONLY to work with visual studios is not required and my patch seems like the fix for this unique case.
I think it is good, if one of committer's who have windows env. can look into it and commit or provide suggestions, else you can make a combined patch of this and other warning you saw on windows and upload to next CF so that it doesn't get lost. I checked that you have already submitted a patch for this warning alone in CF.
I was not quite sure what I should do for these tiny patches. Quite often if a committer happens to read the post and agrees with the patch then it might get committed pretty quickly even outside a commitfest, but if not then if I didn't add to the commitfest then it would likely get lost.