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

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 30 23:44:52 PDT 2023


var-const created this revision.
Herald added a project: All.
var-const requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159249

Files:
  libcxx/include/regex


Index: libcxx/include/regex
===================================================================
--- libcxx/include/regex
+++ libcxx/include/regex
@@ -1459,7 +1459,7 @@
     _LIBCPP_INLINE_VISIBILITY
     __state()
         : __do_(0), __first_(nullptr), __current_(nullptr), __last_(nullptr),
-          __node_(nullptr), __flags_() {}
+          __node_(nullptr), __flags_(), __at_first(false) {}
 };
 
 // __node


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159249.554907.patch
Type: text/x-patch
Size: 415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230831/ca657cf8/attachment.bin>


More information about the libcxx-commits mailing list