🐛 when pre_log_size == 0, illegal instruction would be generated

This commit is contained in:
William Katz 2021-06-06 17:30:45 -07:00 committed by GitHub
parent 11647eb827
commit 3a2f04ab3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,9 +22,15 @@ void SaveSig(int s)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// Static assertations for logging only (!max_log_size) static_assert(pre_log_size <= max_log_size, "`max_log_size` must be larger than `pre_log_size`.");
static_assert(!max_log_size || pre_log_size < max_log_size, "`max_log_size` must be larger than `pre_log_size`."); if constexpr (max_log_size && pre_log_size)
static_assert(!max_log_size || !(max_log_size % pre_log_size), "`max_log_size` must be a multiple of `pre_log_size`."); {
if (max_log_size % pre_log_size)
{
std::cerr << "`max_log_size` must be a multiple of `pre_log_size`.";
return 0;
}
}
if (argc != 4) if (argc != 4)
{ {