[PATCH] Fix unused malloc return value warning

François Dumont frs.dumont@gmail.com
Thu Aug 29 20:50:00 GMT 2019


Hi

     I am having this warning:

/home/fdt/dev/gcc/git/libstdc++-v3/testsuite/util/testsuite_performance.h:170: 
attention: ignoring return value of « void* malloc(size_t) » declared 
with attribute « warn_unused_result » [-Wunused-result]
   170 |       malloc(0); // Needed for some implementations.

     Ok to fix it with attached patch ?

     It seems trivial but I wonder if I shouldn't keep the malloc 
returned pointer and free it properly ?

     Or maybe just remove the malloc cause there is not clear comment 
explaining why it's needed and I haven't found much in SVN audit trail.

     * testsuite_files/util/testsuite_performance.h
     (resource_counter::start): Ignore unused malloc(0) result.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsuite_performance.h.patch
Type: text/x-patch
Size: 609 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190829/cfcd66e7/attachment.bin>


More information about the Gcc-patches mailing list