Re: warn_unused_results

2020-11-11 Thread Peter Eisentraut
On 2020-11-10 04:34, Michael Paquier wrote: 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 doc

Re: warn_unused_results

2020-11-09 Thread Michael Paquier
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

Re: warn_unused_results

2020-11-08 Thread Peter Eisentraut
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 th

Re: warn_unused_results

2020-11-08 Thread Michael Paquier
On Sat, Oct 17, 2020 at 08:57:51AM +0200, Peter Eisentraut wrote: > Forgetting to assign the return value of list APIs such as lappend() is a > perennial favorite. The compiler can help point out such mistakes. GCC has > an attribute warn_unused_results. Also C++ has standardized this

Re: warn_unused_results

2020-10-23 Thread Peter Eisentraut
On 2020-10-17 17:58, Tom Lane wrote: Peter Eisentraut writes: Forgetting to assign the return value of list APIs such as lappend() is a perennial favorite. The compiler can help point out such mistakes. GCC has an attribute warn_unused_results. Also C++ has standardized this under the name

Re: warn_unused_results

2020-10-17 Thread Tom Lane
Peter Eisentraut writes: > Forgetting to assign the return value of list APIs such as lappend() is > a perennial favorite. The compiler can help point out such mistakes. > GCC has an attribute warn_unused_results. Also C++ has standardized > this under the name "nodisc

warn_unused_results

2020-10-16 Thread Peter Eisentraut
Forgetting to assign the return value of list APIs such as lappend() is a perennial favorite. The compiler can help point out such mistakes. GCC has an attribute warn_unused_results. Also C++ has standardized this under the name "nodiscard", and C has a proposal to do the same [