[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 5c76c96 2/6: Initialize local POD variables a
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 5c76c96 2/6: Initialize local POD variables at point of declaration [404] |
Date: |
Tue, 31 Jan 2017 21:20:57 +0000 (UTC) |
branch: master
commit 5c76c969219c40a2f9289001a48f0fa8374f5e2e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Initialize local POD variables at point of declaration [404]
These were previously uninitialized [C++11 8.5/11], so their values
were indeterminate, and using them would have engendered UB. Now they
are appropriately initialized to diagnosably invalid values--which are
now actually diagnosed.
---
input_sequence.cpp | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/input_sequence.cpp b/input_sequence.cpp
index dda2242..e7a7eda 100644
--- a/input_sequence.cpp
+++ b/input_sequence.cpp
@@ -532,8 +532,8 @@ void InputSequence::intervalic_duration()
+ begin_excl
;
duration_mode tentative_begin_duration_mode = current_duration_scalar_mode;
- int tentative_end_duration;
- duration_mode tentative_end_duration_mode;// TODO ?? expunge = e_duration;;
+ int tentative_end_duration = -1;
+ duration_mode tentative_end_duration_mode = e_invalid_mode;
match(e_minor_separator); // TODO ?? Require this?
duration_scalar();
if
@@ -617,6 +617,21 @@ void InputSequence::validate_duration
mark_diagnostic_context();
return;
}
+ else if
+ ( e_invalid_mode == tentative_begin_duration_mode
+ || e_invalid_mode == tentative_end_duration_mode
+ )
+ {
+ current_interval.insane = true;
+ diagnostics
+ << "Interval "
+ << "[ " << tentative_begin_duration << ", "
+ << tentative_end_duration << " )"
+ << " has an invalid duration mode. "
+ ;
+ mark_diagnostic_context();
+ return;
+ }
else
{
current_interval.begin_duration = tentative_begin_duration ;
- [lmi-commits] [lmi] master updated (d040068 -> 2286e57), Greg Chicares, 2017/01/31
- [lmi-commits] [lmi] master ca6ff86 1/6: Improve documentation, Greg Chicares, 2017/01/31
- [lmi-commits] [lmi] master 9d19cdc 3/6: Resolve a marked defect: need not check input for NaN [403], Greg Chicares, 2017/01/31
- [lmi-commits] [lmi] master 5c76c96 2/6: Initialize local POD variables at point of declaration [404],
Greg Chicares <=
- [lmi-commits] [lmi] master b6a43b5 5/6: Test input-sequence keywords-only switch [401], Greg Chicares, 2017/01/31
- [lmi-commits] [lmi] master 2286e57 6/6: Transliterate some unit-test examples for concinnity, Greg Chicares, 2017/01/31
- [lmi-commits] [lmi] master 4ecdb09 4/6: Resolve a marked defect: duration keywords already tested [402], Greg Chicares, 2017/01/31