From 3fec07f3a0475a35fa275fb8696180cbda8bf559 Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Mon, 18 Mar 2024 21:16:30 +0100 Subject: [PATCH] common: valgrind explicitly disabled by default Signed-off-by: Tomasz Gromadzki --- src/Makefile.inc | 5 ++++- src/benchmarks/Makefile | 10 +++++++++- src/core/valgrind_internal.h | 4 ++-- src/test/Makefile.inc | 3 +++ src/test/unittest/Makefile | 8 ++++++++ src/tools/Makefile.inc | 5 ++++- 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/Makefile.inc b/src/Makefile.inc index 561bf4b6ac7..f6955354cc9 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright 2014-2023, Intel Corporation +# Copyright 2014-2024, Intel Corporation # # src/Makefile.inc -- common Makefile rules for PMDK # @@ -106,6 +106,9 @@ endif ifeq ($(VALGRIND),1) CFLAGS += -DVALGRIND_ENABLED=1 CXXFLAGS += -DVALGRIND_ENABLED=1 +else +CFLAGS += -DVALGRIND_ENABLED=0 +CXXFLAGS += -DVALGRIND_ENABLED=0 endif ifeq ($(FAULT_INJECTION),1) diff --git a/src/benchmarks/Makefile b/src/benchmarks/Makefile index f70c4f17856..f4ea1bf1198 100644 --- a/src/benchmarks/Makefile +++ b/src/benchmarks/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright 2014-2023, Intel Corporation +# Copyright 2014-2024, Intel Corporation # # src/benchmarks/Makefile -- build all benchmarks @@ -109,6 +109,14 @@ LDFLAGS += $(GCOV_LDFLAGS) LIBS += $(GCOV_LIBS) endif +ifeq ($(VALGRIND),1) +CFLAGS += -DVALGRIND_ENABLED=1 +CXXFLAGS += -DVALGRIND_ENABLED=1 +else +CFLAGS += -DVALGRIND_ENABLED=0 +CXXFLAGS += -DVALGRIND_ENABLED=0 +endif + ifneq ($(SANITIZE),) CXXFLAGS += -fsanitize=$(SANITIZE) LDFLAGS += -fsanitize=$(SANITIZE) diff --git a/src/core/valgrind_internal.h b/src/core/valgrind_internal.h index 54d85fdd392..c07da17be94 100644 --- a/src/core/valgrind_internal.h +++ b/src/core/valgrind_internal.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright 2015-2023, Intel Corporation */ +/* Copyright 2015-2024, Intel Corporation */ /* * valgrind_internal.h -- internal definitions for valgrind macros @@ -10,7 +10,7 @@ #if !defined(__riscv) && !defined(__loongarch64) #ifndef VALGRIND_ENABLED -#define VALGRIND_ENABLED 0 +#error VALGRIND_ENABLED must be explicitly set #endif #endif diff --git a/src/test/Makefile.inc b/src/test/Makefile.inc index 07942e99ef5..6781b2c6ede 100644 --- a/src/test/Makefile.inc +++ b/src/test/Makefile.inc @@ -521,6 +521,9 @@ endif ifeq ($(VALGRIND),1) CFLAGS += -DVALGRIND_ENABLED=1 CXXFLAGS += -DVALGRIND_ENABLED=1 +else +CFLAGS += -DVALGRIND_ENABLED=0 +CXXFLAGS += -DVALGRIND_ENABLED=0 endif ifeq ($(FAULT_INJECTION),1) diff --git a/src/test/unittest/Makefile b/src/test/unittest/Makefile index 6244049d16b..7ee63cf77cf 100644 --- a/src/test/unittest/Makefile +++ b/src/test/unittest/Makefile @@ -72,6 +72,14 @@ LDFLAGS += $(GCOV_LDFLAGS) LIBS += $(GCOV_LIBS) endif +ifeq ($(VALGRIND),1) +CFLAGS += -DVALGRIND_ENABLED=1 +CXXFLAGS += -DVALGRIND_ENABLED=1 +else +CFLAGS += -DVALGRIND_ENABLED=0 +CXXFLAGS += -DVALGRIND_ENABLED=0 +endif + CFLAGS += $(EXTRA_CFLAGS) LIBS += $(LIBUTIL) diff --git a/src/tools/Makefile.inc b/src/tools/Makefile.inc index fb96ced2378..f6fe208d4b9 100644 --- a/src/tools/Makefile.inc +++ b/src/tools/Makefile.inc @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright 2014-2023, Intel Corporation +# Copyright 2014-2024, Intel Corporation # # src/tools/Makefile.inc -- Makefile include for all tools # @@ -67,6 +67,9 @@ endif ifeq ($(VALGRIND),1) CFLAGS += -DVALGRIND_ENABLED=1 CXXFLAGS += -DVALGRIND_ENABLED=1 +else +CFLAGS += -DVALGRIND_ENABLED=0 +CXXFLAGS += -DVALGRIND_ENABLED=0 endif ifeq ($(FAULT_INJECTION),1)