Re: Windows build warnings
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Nancarrow <gregn4422@gmail.com>
Cc: Daniel Gustafsson <daniel@yesql.se>,
Alvaro Herrera <alvherre@alvh.no-ip.org>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-11-26T04:45:09Z
Lists: pgsql-hackers
Greg Nancarrow <gregn4422@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
Commits
-
Disable unused-variable warning C4101 in MSVC
- e7122548a3f7 15.0 landed
-
Remove PF_USED_FOR_ASSERTS_ONLY from variables in general use
- ac0db34e0e5c 15.0 landed
-
Fix handling of non-key columns get_index_column_opclass()
- 7e0416039046 13.0 cited