[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 079/115] configure: Do not ignore malloc value
From: |
Paolo Bonzini |
Subject: |
[PULL 079/115] configure: Do not ignore malloc value |
Date: |
Thu, 11 Jun 2020 15:44:13 -0400 |
From: Leonid Bloch <lbloch@janustech.com>
Not checking the value of malloc will cause a warning with GCC 10.1,
which may result in configuration failure, with the following line in
config.log:
config-temp/qemu-conf.c:2:18: error: ignoring return value of ‘malloc’
declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
2 | int main(void) { malloc(1); return 0; }
| ^~~~~~~~~
Signed-off-by: Leonid Bloch <lb.workbox@gmail.com>
Message-Id: <20200524221204.9791-1-lb.workbox@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 53a6dd0297..dbc16b5656 100755
--- a/configure
+++ b/configure
@@ -4587,7 +4587,13 @@ fi
if test "$tcmalloc" = "yes" ; then
cat > $TMPC << EOF
#include <stdlib.h>
-int main(void) { malloc(1); return 0; }
+int main(void) {
+ void *tmp = malloc(1);
+ if (tmp != NULL) {
+ return 0;
+ }
+ return 1;
+}
EOF
if compile_prog "" "-ltcmalloc" ; then
@@ -4603,7 +4609,13 @@ fi
if test "$jemalloc" = "yes" ; then
cat > $TMPC << EOF
#include <stdlib.h>
-int main(void) { malloc(1); return 0; }
+int main(void) {
+ void *tmp = malloc(1);
+ if (tmp != NULL) {
+ return 0;
+ }
+ return 1;
+}
EOF
if compile_prog "" "-ljemalloc" ; then
@@ -6164,7 +6176,9 @@ if test "$sanitizers" = "yes" ; then
#include <stdlib.h>
int main(void) {
void *tmp = malloc(10);
- return *(int *)(tmp + 2);
+ if (tmp != NULL) {
+ return *(int *)(tmp + 2);
+ }
}
EOF
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
--
2.26.2
- [PULL 019/115] vmbus: vmbus implementation, (continued)
- [PULL 019/115] vmbus: vmbus implementation, Paolo Bonzini, 2020/06/11
- [PULL 022/115] vmbus: add infrastructure to save/load vmbus requests, Paolo Bonzini, 2020/06/11
- [PULL 057/115] exec: Propagate cpu_memory_rw_debug() error, Paolo Bonzini, 2020/06/11
- [PULL 031/115] hw/i386/vmport: Introduce vmport.h, Paolo Bonzini, 2020/06/11
- [PULL 047/115] i386/kvm: fix a use-after-free when vcpu plug/unplug, Paolo Bonzini, 2020/06/11
- [PULL 040/115] qom: remove index from object_resolve_abs_path(), Paolo Bonzini, 2020/06/11
- [PULL 070/115] chardev/char-socket: Properly make qio connections non blocking, Paolo Bonzini, 2020/06/11
- [PULL 072/115] hw/i386/amd_iommu: Fix the reserved bits definition of IOMMU commands, Paolo Bonzini, 2020/06/11
- [PULL 068/115] KVM: Pass EventNotifier into kvm_irqchip_assign_irqfd, Paolo Bonzini, 2020/06/11
- [PULL 076/115] util/oslib: Returns the real thread identifier on FreeBSD and NetBSD, Paolo Bonzini, 2020/06/11
- [PULL 079/115] configure: Do not ignore malloc value,
Paolo Bonzini <=
- [PULL 075/115] target/i386: define a new MSR based feature word - FEAT_PERF_CAPABILITIES, Paolo Bonzini, 2020/06/11
- [PULL 074/115] i386: Remove unused define's from hax and hvf, Paolo Bonzini, 2020/06/11
- [PULL 077/115] memory: Make 'info mtree' not display disabled regions by default, Paolo Bonzini, 2020/06/11
- [PULL 078/115] qemu/thread: Mark qemu_thread_exit() with 'noreturn' attribute, Paolo Bonzini, 2020/06/11
- [PULL 071/115] tests: machine-none-test: Enable MicroBlaze testing, Paolo Bonzini, 2020/06/11
- [PULL 050/115] megasas: use unsigned type for positive numeric fields, Paolo Bonzini, 2020/06/11
- [PULL 084/115] sysemu/tcg: Only declare tcg_allowed when TCG is available, Paolo Bonzini, 2020/06/11
- [PULL 082/115] target/i386: correct fix for pcmpxstrx substring search, Paolo Bonzini, 2020/06/11
- [PULL 081/115] target/i386: fix IEEE x87 floating-point exception raising, Paolo Bonzini, 2020/06/11
- [PULL 089/115] i386: hvf: Drop unused variable, Paolo Bonzini, 2020/06/11