Skip to content

[WIP] Add portable Clang safety annotations#837

Open
SchrodingerZhu wants to merge 1 commit intomicrosoft:mainfrom
SchrodingerZhu:snmalloc-clang
Open

[WIP] Add portable Clang safety annotations#837
SchrodingerZhu wants to merge 1 commit intomicrosoft:mainfrom
SchrodingerZhu:snmalloc-clang

Conversation

@SchrodingerZhu
Copy link
Copy Markdown
Collaborator

Summary

  • add portable Clang thread-safety and lifetime annotation shims
  • annotate the lock-backed structures and APIs that map cleanly onto Clang's analyses
  • detect and enable supported lifetime-safety warning and inference flags in CMake

Validation

  • clang++ -std=c++20 -I src -mcx16 -DSNMALLOC_USE_WAIT_ON_ADDRESS=1 -fsyntax-only -Wthread-safety src/test/func/pool/pool.cc
  • clang++ -std=c++20 -I src -mcx16 -DSNMALLOC_USE_WAIT_ON_ADDRESS=1 -fsyntax-only -Wthread-safety src/test/func/first_operation/first_operation.cc
  • clang++ -std=c++20 -I src -mcx16 -DSNMALLOC_USE_WAIT_ON_ADDRESS=1 -fsyntax-only -Wexperimental-lifetime-safety-permissive -Wexperimental-lifetime-safety-suggestions src/test/func/pool/pool.cc
  • clang++ -std=c++20 -I src -mcx16 -DSNMALLOC_USE_WAIT_ON_ADDRESS=1 -fsyntax-only -Wexperimental-lifetime-safety-permissive -Wexperimental-lifetime-safety-suggestions src/test/func/first_operation/first_operation.cc

@SchrodingerZhu SchrodingerZhu changed the title Add portable Clang safety annotations [WIP] Add portable Clang safety annotations Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant