Skip to content

Commit

Permalink
fix: Enable debug flag for ubsan.
Browse files Browse the repository at this point in the history
Otherwise the nullability annotations are compiled out in attributes.h.
  • Loading branch information
iphydf committed Dec 9, 2023
1 parent 65b3375 commit 8238f31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .circleci/cmake-ubsan
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ CACHEDIR="$HOME/cache"

. ".github/scripts/flags-$CC.sh"
add_flag -Werror
add_flag -D_DEBUG
add_flag -fdiagnostics-color=always
add_flag -fno-omit-frame-pointer
add_flag -fno-sanitize-recover=all
add_flag -fsanitize-trap=all
add_flag -fsanitize=undefined,nullability,local-bounds,float-divide-by-zero,integer
add_flag -fno-sanitize=implicit-conversion,unsigned-integer-overflow
# Enable extra checks. We only do this on ubsan because it shows useful error
Expand Down
2 changes: 1 addition & 1 deletion toxcore/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define GNU_PRINTF(f, a)
#endif

#if defined(__GNUC__) && defined(_DEBUG) && !defined(__OPTIMIZE__)
#if defined(__GNUC__) && (!defined(__OPTIMIZE__) || defined(_DEBUG))
#define non_null(...) __attribute__((__nonnull__(__VA_ARGS__)))
#else
#define non_null(...)
Expand Down

0 comments on commit 8238f31

Please sign in to comment.