Skip to content

Commit 648bc88

Browse files
committed
malloc.c: silence "unused result" compiler warning
Before: malloc.c: In function ‘getpages’: malloc.c:273:34: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 273 | # define fatalcroak(mess) (write(2, (mess), strlen(mess)), exit(2)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ malloc.c:1546:21: note: in expansion of macro ‘fatalcroak’ 1546 | fatalcroak("panic: Off-page sbrk\n"); | ^~~~~~~~~~ malloc.c:273:34: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 273 | # define fatalcroak(mess) (write(2, (mess), strlen(mess)), exit(2)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ malloc.c:1585:13: note: in expansion of macro ‘fatalcroak’ 1585 | fatalcroak("Misalignment of sbrk()\n"); | ^~~~~~~~~~ gcc -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -Wno-use-after-free universal.c (The "make depend" comment was overlooked in commit b9e5552.)
1 parent a5ccef6 commit 648bc88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

malloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@
269269
# define MALLOC_UNLOCK MUTEX_UNLOCK(&PL_malloc_mutex)
270270
#endif
271271

272-
# ifndef fatalcroak /* make depend */
273-
# define fatalcroak(mess) (write(2, (mess), strlen(mess)), exit(2))
274-
# endif
272+
#ifndef fatalcroak
273+
# define fatalcroak(mess) STMT_START { PERL_UNUSED_RESULT(write(2, (mess), strlen(mess))); exit(2); } STMT_END
274+
#endif
275275

276276
#ifdef DEBUGGING
277277
# undef DEBUG_m

0 commit comments

Comments
 (0)