If building with clang then enable -Wthread-safety warnings.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Makefile.config | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 0661a1cf9855..0ef6f572485d 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -19,6 +19,11 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
+# Enabled Wthread-safety analysis for clang builds.
+ifeq ($(CC_NO_CLANG), 0)
+ CFLAGS += -Wthread-safety
+endif
+
include $(srctree)/tools/scripts/Makefile.arch
$(call detected_var,SRCARCH)
--
2.37.1.595.g718a3a8f04-goog
Hi Ian, On Tue, Aug 16, 2022 at 10:39 PM Ian Rogers <irogers@google.com> wrote: > > If building with clang then enable -Wthread-safety warnings. Do you know the minimal supported version for the option? I'm not sure we have a check for that kind of thing. Thanks, Namhyung > > Signed-off-by: Ian Rogers <irogers@google.com> > --- > tools/perf/Makefile.config | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config > index 0661a1cf9855..0ef6f572485d 100644 > --- a/tools/perf/Makefile.config > +++ b/tools/perf/Makefile.config > @@ -19,6 +19,11 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) > CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) > HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) > > +# Enabled Wthread-safety analysis for clang builds. > +ifeq ($(CC_NO_CLANG), 0) > + CFLAGS += -Wthread-safety > +endif > + > include $(srctree)/tools/scripts/Makefile.arch > > $(call detected_var,SRCARCH) > -- > 2.37.1.595.g718a3a8f04-goog >
On Wed, Aug 17, 2022, 11:11 PM Namhyung Kim <namhyung@kernel.org> wrote: > > Hi Ian, > > On Tue, Aug 16, 2022 at 10:39 PM Ian Rogers <irogers@google.com> wrote: > > > > If building with clang then enable -Wthread-safety warnings. > > Do you know the minimal supported version for the option? > I'm not sure we have a check for that kind of thing. It has been supported for a long time, close to 10 years. Looking around it looks like clang 3.5 had the support. For context, BPF was supported after clang 3.7. Given this long support, and we don't version check for BPF, I think it is okay to assume the flag is supported. Thanks, Ian > > Thanks, > Namhyung > > > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > --- > > tools/perf/Makefile.config | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config > > index 0661a1cf9855..0ef6f572485d 100644 > > --- a/tools/perf/Makefile.config > > +++ b/tools/perf/Makefile.config > > @@ -19,6 +19,11 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) > > CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) > > HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) > > > > +# Enabled Wthread-safety analysis for clang builds. > > +ifeq ($(CC_NO_CLANG), 0) > > + CFLAGS += -Wthread-safety > > +endif > > + > > include $(srctree)/tools/scripts/Makefile.arch > > > > $(call detected_var,SRCARCH) > > -- > > 2.37.1.595.g718a3a8f04-goog > >
On Thu, Aug 18, 2022 at 6:17 AM Ian Rogers <irogers@google.com> wrote: > > On Wed, Aug 17, 2022, 11:11 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > Hi Ian, > > > > On Tue, Aug 16, 2022 at 10:39 PM Ian Rogers <irogers@google.com> wrote: > > > > > > If building with clang then enable -Wthread-safety warnings. > > > > Do you know the minimal supported version for the option? > > I'm not sure we have a check for that kind of thing. > > > It has been supported for a long time, close to 10 years. Looking > around it looks like clang 3.5 had the support. For context, BPF was > supported after clang 3.7. Given this long support, and we don't > version check for BPF, I think it is okay to assume the flag is > supported. Good, thanks for checking it.
On Thu, Aug 18, 2022 at 8:59 AM Namhyung Kim <namhyung@kernel.org> wrote: > > On Thu, Aug 18, 2022 at 6:17 AM Ian Rogers <irogers@google.com> wrote: > > > > On Wed, Aug 17, 2022, 11:11 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > > > Hi Ian, > > > > > > On Tue, Aug 16, 2022 at 10:39 PM Ian Rogers <irogers@google.com> wrote: > > > > > > > > If building with clang then enable -Wthread-safety warnings. > > > > > > Do you know the minimal supported version for the option? > > > I'm not sure we have a check for that kind of thing. > > > > > > It has been supported for a long time, close to 10 years. Looking > > around it looks like clang 3.5 had the support. For context, BPF was > > supported after clang 3.7. Given this long support, and we don't > > version check for BPF, I think it is okay to assume the flag is > > supported. > > Good, thanks for checking it. It was a good point, thanks for the reminder! Ian
© 2016 - 2026 Red Hat, Inc.