Skip to content

Commit 73d52cd

Browse files
committed
chore: Disable non-null attributes by default.
We enable them on CI, but a default build will compile without them so a default build doesn't end up with lots of warnings (which we also disable on CI).
1 parent a0a317d commit 73d52cd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.circleci/cmake-ubsan

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ add_flag -fno-omit-frame-pointer
1111
add_flag -fno-sanitize-recover=all
1212
add_flag -fsanitize=undefined,nullability,local-bounds,float-divide-by-zero,integer
1313
add_flag -fno-sanitize=implicit-conversion,unsigned-integer-overflow
14+
# Enable extra checks. We only do this on ubsan because it shows useful error
15+
# messages for the kind of bugs this catches (mostly incorrect nullability
16+
# annotations). Other builds will segfault, ubsan will show a stack trace.
17+
add_flag -D_DEBUG
1418
cmake -B_build -H. -GNinja \
1519
-DCMAKE_C_FLAGS="$C_FLAGS" \
1620
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \

toxcore/attributes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define GNU_PRINTF(f, a)
1919
#endif
2020

21-
#if defined(__GNUC__) && !defined(NDEBUG)
21+
#if defined(__GNUC__) && defined(_DEBUG)
2222
#define non_null(...) __attribute__((__nonnull__(__VA_ARGS__)))
2323
#else
2424
#define non_null(...)

0 commit comments

Comments
 (0)