Default to pattern initialization for uninitialized variables (try 2).
Pattern initialization helps us make C++ safer, while not altering the
semantics/usage of C++ (as zero init does).
Bug: 131390872
Test: Local testing. Parts of CTS.
Change-Id: Ic4af9260a48c10cbd70315fa56d6b01c5ca61768
diff --git a/cc/config/global.go b/cc/config/global.go
index 44de4d5..ec09d22 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -168,6 +168,9 @@
flags = append(flags, "-ftrivial-auto-var-init=pattern")
} else if ctx.Config().IsEnvTrue("AUTO_UNINITIALIZE") {
flags = append(flags, "-ftrivial-auto-var-init=uninitialized")
+ } else {
+ // Default to pattern initialization.
+ flags = append(flags, "-ftrivial-auto-var-init=pattern")
}
return strings.Join(flags, " ")