Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc][pthread] fix -Wmissing-field-initializers #126314

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libc/include/llvm-libc-macros/pthread-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#define PTHREAD_PROCESS_PRIVATE 0
#define PTHREAD_PROCESS_SHARED 1

#define PTHREAD_MUTEX_INITIALIZER {0}
#define PTHREAD_RWLOCK_INITIALIZER {0}
#define PTHREAD_MUTEX_INITIALIZER {}
#define PTHREAD_RWLOCK_INITIALIZER {}

// glibc extensions
#define PTHREAD_STACK_MIN (1 << 14) // 16KB
Expand Down
4 changes: 4 additions & 0 deletions libc/test/integration/src/pthread/pthread_mutex_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ void multiple_waiters() {
LIBC_NAMESPACE::pthread_mutex_destroy(&counter_lock);
}

// Test the initializer
[[gnu::unused]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not [[maybe_unused]]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! I always forget that that one got standardized.
bfc84ca

static pthread_mutex_t test_initializer = PTHREAD_MUTEX_INITIALIZER;

TEST_MAIN() {
relay_counter();
wait_and_step();
Expand Down
Loading