Greg Nancarrow <gregn4...@gmail.com> writes: > AFAICS, the fundamental difference here seems to be that the GCC > compiler still regards a variable as "unused" if it is never read, > whereas if the variable is set (but not necessarily read) that's > enough for the Windows C compiler to regard it as "used".
It depends. Older gcc versions don't complain about set-but-not-read variables, but clang has done so for awhile (with a specific warning message about the case), and I think recent gcc follows suit. > Personally I'm not really in favour of outright disabling the C4101 > warning on Windows, because I think it is a useful warning for > Postgres developers on Windows for cases unrelated to the use of > PG_USED_FOR_ASSERTS_ONLY. IMO we should either do that or do whatever's necessary to make the macro work properly on MSVC. I'm not very much in favor of jumping through hoops to satisfy a compiler that has a randomly-different- but-still-demonstrably-inadequate version of this warning. regards, tom lane