Skip to content

Commit

Permalink
app: enable lock check
Browse files Browse the repository at this point in the history
Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Nov 18, 2024
1 parent f6ea201 commit 6b9d451
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ foreach app:apps
reason = '<unknown reason>' # set if build == false to explain
sources = []
includes = []
annotate_locks = true
cflags = default_cflags
ldflags = default_ldflags
objs = [] # other object files to link against, used e.g. for
Expand Down Expand Up @@ -114,6 +115,11 @@ foreach app:apps
link_libs = dpdk_static_libraries + dpdk_drivers
endif

if annotate_locks and cc.has_argument('-Wthread-safety')
cflags += '-DRTE_ANNOTATE_LOCKS'
cflags += '-Wthread-safety'
endif

exec = executable('dpdk-' + name,
sources,
c_args: cflags,
Expand Down
5 changes: 5 additions & 0 deletions app/test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ cflags += '-fno-strict-aliasing'
# Enable using internal APIs in unit tests
cflags += '-DALLOW_INTERNAL_API'

if cc.has_argument('-Wthread-safety')
cflags += '-DRTE_ANNOTATE_LOCKS'
cflags += '-Wthread-safety'
endif

# create a symlink in the app/test directory for the binary, for backward compatibility
if not is_windows
custom_target('test_symlink',
Expand Down
2 changes: 2 additions & 0 deletions app/test/test_rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright(c) 2010-2014 Intel Corporation
*/

#undef RTE_ANNOTATE_LOCKS

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
Expand Down
2 changes: 2 additions & 0 deletions app/test/test_spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright(c) 2010-2014 Intel Corporation
*/

#undef RTE_ANNOTATE_LOCKS

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
Expand Down

0 comments on commit 6b9d451

Please sign in to comment.