On Mon, Nov 09, 2020 at 08:23:31AM +0100, Peter Eisentraut wrote: > On 2020-11-09 07:56, Michael Paquier wrote: >> This is accepted by clang, and MSVC has visibly an equivalent for >> that, as of VS 2012: >> #elif defined(_MSC_VER) && (_MSC_VER >= 1700) >> #define pg_nodiscard _Check_return_ >> We don't care about the 1700 condition as we support only >= 1800 on >> HEAD, and in this case the addition of pg_nodiscard would be required >> on the definition and the declaration. Should it be added? It is >> much more invasive than the gcc/clang equivalent though.. > > AFAICT from the documentation, this only applies for special "analyze" runs, > not as a normal compiler warning. Do we have any support for analyze runs > with MSVC?
You can run them by passing down /p:RunCodeAnalysis=true to MSBFLAGS when calling the build script. There are more options like /p:CodeAnalysisRuleSet to define a set of rules. By default the output is rather noisy though now that I look at it. And having to add the flag to the definition and the declaration is annoying, so what you are doing would be enough without MSVC. >> I am not sure >> about the addition of repalloc(), as it is quite obvious that one has >> to use its result. Lists are fine, these are proper to PG internals >> and beginners tend to be easily confused in the way to use them. > > realloc() is listed in the GCC documentation as the reason this option > exists, and glibc tags its realloc() with this attribute, so doing the same > for repalloc() seems sensible. Good point. -- Michael
signature.asc
Description: PGP signature