Re: Windows build warnings
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Greg Nancarrow <gregn4422@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-11-22T15:40:48Z
Lists: pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes: > Fair enough. Looking at where we use PG_USED_FOR_ASSERTS_ONLY (and where it > works), these two warnings are the only places where we apply it to a pointer > typedef (apart from one place where the variable is indeed used outside of > asserts). Since it clearly works in all other cases, I wonder if something > like the below sketch could make MSVC handle the attribute? Ugh. If we're changing the code anyway, I think I prefer Greg's original patch; it's at least not randomly inconsistent with everything else. However ... I question your assumption that it works everywhere else. I can't find anything that is providing a non-empty definition of PG_USED_FOR_ASSERTS_ONLY (a/k/a pg_attribute_unused) for anything except GCC. It seems likely to me that MSVC simply fails to produce such warnings in most places, but it's woken up and done so here. 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