Skip to content

Commit

Permalink
Use constexpr default constructors with unreachable comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Jan 21, 2025
1 parent c1d6819 commit a8aa40b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions src/quarterly-shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ year::is_leap() const NOEXCEPT {
case start::october: return to_quarterly<start::october>(*this).is_leap();
case start::november: return to_quarterly<start::november>(*this).is_leap();
case start::december: return to_quarterly<start::december>(*this).is_leap();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ false;

Check warning on line 254 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L254

Added line #L254 was not covered by tests
}
}

Expand All @@ -277,7 +277,7 @@ operator+(const year& x, const quarterly::years& y) NOEXCEPT
case start::october: return from_quarterly(to_quarterly<start::october>(x) + y);
case start::november: return from_quarterly(to_quarterly<start::november>(x) + y);
case start::december: return from_quarterly(to_quarterly<start::december>(x) + y);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ year();

Check warning on line 280 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L280

Added line #L280 was not covered by tests
}
}

Expand All @@ -303,7 +303,7 @@ operator-(const year& x, const year& y) NOEXCEPT
case start::october: return to_quarterly<start::october>(x) - to_quarterly<start::october>(y);
case start::november: return to_quarterly<start::november>(x) - to_quarterly<start::november>(y);
case start::december: return to_quarterly<start::december>(x) - to_quarterly<start::december>(y);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ quarterly::years();

Check warning on line 306 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L306

Added line #L306 was not covered by tests
}
}

Expand Down Expand Up @@ -355,7 +355,7 @@ operator+(const year_quarternum& yqn, const quarterly::quarters& dq) NOEXCEPT
case start::october: return from_quarterly(to_quarterly<start::october>(yqn) + dq);
case start::november: return from_quarterly(to_quarterly<start::november>(yqn) + dq);
case start::december: return from_quarterly(to_quarterly<start::december>(yqn) + dq);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ year_quarternum();

Check warning on line 358 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L358

Added line #L358 was not covered by tests
}
}

Expand All @@ -381,7 +381,7 @@ operator-(const year_quarternum& x, const year_quarternum& y) NOEXCEPT
case start::october: return to_quarterly<start::october>(x) - to_quarterly<start::october>(y);
case start::november: return to_quarterly<start::november>(x) - to_quarterly<start::november>(y);
case start::december: return to_quarterly<start::december>(x) - to_quarterly<start::december>(y);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ quarterly::quarters();

Check warning on line 384 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L384

Added line #L384 was not covered by tests
}
}

Expand Down Expand Up @@ -446,7 +446,7 @@ year_quarternum_quarterday::from_sys_days(const date::sys_days& dp, quarterly::s
case start::october: return from_quarterly(quarterly::year_quarternum_quarterday<start::october>(dp));
case start::november: return from_quarterly(quarterly::year_quarternum_quarterday<start::november>(dp));
case start::december: return from_quarterly(quarterly::year_quarternum_quarterday<start::december>(dp));
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ year_quarternum_quarterday();

Check warning on line 449 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L449

Added line #L449 was not covered by tests
}
}

Expand Down Expand Up @@ -501,7 +501,7 @@ year_quarternum_quarterday::operator date::sys_days() const NOEXCEPT
case start::october: return to_quarterly<start::october>(*this);
case start::november: return to_quarterly<start::november>(*this);
case start::december: return to_quarterly<start::december>(*this);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ date::sys_days();

Check warning on line 504 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L504

Added line #L504 was not covered by tests
}
}

Expand All @@ -525,7 +525,7 @@ year_quarternum_quarterday::operator date::local_days() const NOEXCEPT
case start::october: return date::local_days(to_quarterly<start::october>(*this));
case start::november: return date::local_days(to_quarterly<start::november>(*this));
case start::december: return date::local_days(to_quarterly<start::december>(*this));
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ date::local_days();
}
}

Expand All @@ -550,7 +550,7 @@ year_quarternum_quarterday::ok() const NOEXCEPT
case start::october: return to_quarterly<start::october>(*this).ok();
case start::november: return to_quarterly<start::november>(*this).ok();
case start::december: return to_quarterly<start::december>(*this).ok();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ false;

Check warning on line 553 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L553

Added line #L553 was not covered by tests
}
}

Expand Down Expand Up @@ -608,7 +608,7 @@ year_quarternum_quarterday_last::quarterday() const NOEXCEPT
case start::october: return to_quarterly<start::october>(*this).quarterday();
case start::november: return to_quarterly<start::november>(*this).quarterday();
case start::december: return to_quarterly<start::december>(*this).quarterday();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ quarterly::quarterday();

Check warning on line 611 in src/quarterly-shim.h

View check run for this annotation

Codecov / codecov/patch

src/quarterly-shim.h#L611

Added line #L611 was not covered by tests
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/week-shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ year::is_leap() const NOEXCEPT {
case start::thursday: return to_week<start::thursday>(*this).is_leap();
case start::friday: return to_week<start::friday>(*this).is_leap();
case start::saturday: return to_week<start::saturday>(*this).is_leap();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ false;

Check warning on line 304 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L304

Added line #L304 was not covered by tests
}
}

Expand All @@ -322,7 +322,7 @@ operator+(const year& x, const week::years& y) NOEXCEPT
case start::thursday: return from_week(to_week<start::thursday>(x) + y);
case start::friday: return from_week(to_week<start::friday>(x) + y);
case start::saturday: return from_week(to_week<start::saturday>(x) + y);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ year();

Check warning on line 325 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L325

Added line #L325 was not covered by tests
}
}

Expand All @@ -343,7 +343,7 @@ operator-(const year& x, const year& y) NOEXCEPT
case start::thursday: return to_week<start::thursday>(x) - to_week<start::thursday>(y);
case start::friday: return to_week<start::friday>(x) - to_week<start::friday>(y);
case start::saturday: return to_week<start::saturday>(x) - to_week<start::saturday>(y);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ week::years();

Check warning on line 346 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L346

Added line #L346 was not covered by tests
}
}

Expand Down Expand Up @@ -411,7 +411,7 @@ year_weeknum::ok() const NOEXCEPT
case start::thursday: return to_week<start::thursday>(*this).ok();
case start::friday: return to_week<start::friday>(*this).ok();
case start::saturday: return to_week<start::saturday>(*this).ok();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ false;

Check warning on line 414 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L414

Added line #L414 was not covered by tests
}
}

Expand Down Expand Up @@ -441,7 +441,7 @@ year_lastweek::weeknum() const NOEXCEPT
case start::thursday: return to_week<start::thursday>(*this).weeknum();
case start::friday: return to_week<start::friday>(*this).weeknum();
case start::saturday: return to_week<start::saturday>(*this).weeknum();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ week::weeknum();

Check warning on line 444 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L444

Added line #L444 was not covered by tests
}
}

Expand Down Expand Up @@ -501,7 +501,7 @@ year_weeknum_weekday::from_sys_days(const date::sys_days& dp, week::start s) NOE
case start::thursday: return from_week(week::year_weeknum_weekday<start::thursday>(dp));
case start::friday: return from_week(week::year_weeknum_weekday<start::friday>(dp));
case start::saturday: return from_week(week::year_weeknum_weekday<start::saturday>(dp));
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ year_weeknum_weekday();

Check warning on line 504 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L504

Added line #L504 was not covered by tests
}
}

Expand Down Expand Up @@ -551,7 +551,7 @@ year_weeknum_weekday::operator date::sys_days() const NOEXCEPT
case start::thursday: return to_week<start::thursday>(*this);
case start::friday: return to_week<start::friday>(*this);
case start::saturday: return to_week<start::saturday>(*this);
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ date::sys_days();

Check warning on line 554 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L554

Added line #L554 was not covered by tests
}
}

Expand All @@ -570,7 +570,7 @@ year_weeknum_weekday::operator date::local_days() const NOEXCEPT
case start::thursday: return date::local_days(to_week<start::thursday>(*this));
case start::friday: return date::local_days(to_week<start::friday>(*this));
case start::saturday: return date::local_days(to_week<start::saturday>(*this));
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ date::local_days();
}
}

Expand All @@ -590,7 +590,7 @@ year_weeknum_weekday::ok() const NOEXCEPT
case start::thursday: return to_week<start::thursday>(*this).ok();
case start::friday: return to_week<start::friday>(*this).ok();
case start::saturday: return to_week<start::saturday>(*this).ok();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ false;

Check warning on line 593 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L593

Added line #L593 was not covered by tests
}
}

Expand Down Expand Up @@ -628,7 +628,7 @@ year_lastweek_weekday::weeknum() const NOEXCEPT
case start::thursday: return to_week<start::thursday>(*this).weeknum();
case start::friday: return to_week<start::friday>(*this).weeknum();
case start::saturday: return to_week<start::saturday>(*this).weeknum();
default: throw std::runtime_error("[[unreachable]]");
default: return /* unreachable */ week::weeknum();

Check warning on line 631 in src/week-shim.h

View check run for this annotation

Codecov / codecov/patch

src/week-shim.h#L631

Added line #L631 was not covered by tests
}
}

Expand Down

0 comments on commit a8aa40b

Please sign in to comment.