[libcxx-commits] [libcxx] d2232e6 - [libc++] Initialize all member variables of `__state` in `<regex>`

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 31 22:14:21 PDT 2023


Author: Konstantin Varlamov
Date: 2023-08-31T22:14:01-07:00
New Revision: d2232e687317b749273d0658718cc1668f25472e

URL: https://github.com/llvm/llvm-project/commit/d2232e687317b749273d0658718cc1668f25472e
DIFF: https://github.com/llvm/llvm-project/commit/d2232e687317b749273d0658718cc1668f25472e.diff

LOG: [libc++] Initialize all member variables of `__state` in `<regex>`

This is to prevent a GCC warning (
https://github.com/llvm/llvm-project/issues/65132). It looks like
`__at_first` is always assigned before it's used, but all other member
variables of this struct are initialized in the constructor, so there is
no reason not to initialize `__at_first` as well.

Differential Revision: https://reviews.llvm.org/D159249

Added: 
    

Modified: 
    libcxx/include/regex

Removed: 
    


################################################################################
diff  --git a/libcxx/include/regex b/libcxx/include/regex
index ede112b92c6e59..8cfe2d9ba3a55f 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1459,7 +1459,7 @@ struct __state
     _LIBCPP_INLINE_VISIBILITY
     __state()
         : __do_(0), __first_(nullptr), __current_(nullptr), __last_(nullptr),
-          __node_(nullptr), __flags_() {}
+          __node_(nullptr), __flags_(), __at_first_(false) {}
 };
 
 // __node


        


More information about the libcxx-commits mailing list