This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/13.0 by this push:
new 2cddf4e6384 include/pthread : initialize wait_count in
PTHREAD_COND_INITIALIZER
2cddf4e6384 is described below
commit 2cddf4e6384be69cf0954dd8b4c53f9ad9e05ef8
Author: nicolasWDC <[email protected]>
AuthorDate: Wed Jun 10 12:58:30 2026 +0000
include/pthread : initialize wait_count in PTHREAD_COND_INITIALIZER
struct pthread_cond_s contains three fields: sem, clockid, and
wait_count. However, PTHREAD_COND_INITIALIZER only initialized the first
two fields, which triggers -Wmissing-field-initializers when a condition
variable is statically initialized.
Initialize wait_count explicitly to zero so the macro matches the structure
definition and remains warning-free with strict compiler flags.
Validated with a minimal compile test using:
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
Signed-off-by: nicolasWDC <[email protected]>
---
include/pthread.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/pthread.h b/include/pthread.h
index 561b6070b96..201d593051b 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -279,7 +279,7 @@ typedef struct pthread_cond_s pthread_cond_t;
# define __PTHREAD_COND_T_DEFINED 1
#endif
-#define PTHREAD_COND_INITIALIZER {SEM_INITIALIZER(0), CLOCK_REALTIME }
+#define PTHREAD_COND_INITIALIZER {SEM_INITIALIZER(0), CLOCK_REALTIME, 0}
struct pthread_mutexattr_s
{