diff options
author | Pjotr Prins | 2017-10-20 08:10:39 +0000 |
---|---|---|
committer | Pjotr Prins | 2017-10-23 13:54:05 +0000 |
commit | b42a02d02b3d9384b1da55bd091f0f89c808b626 (patch) | |
tree | 4fd66b70ce7eb660dcb98c38a7f5309ac43195e8 /src/debug.cpp | |
parent | 12558c358150bfed99874b791932bbe06a107263 (diff) | |
download | pangemma-b42a02d02b3d9384b1da55bd091f0f89c808b626.tar.gz |
Travis-ci:
- Disabled gcc-6 since we develop with later tools anyway
- Turned the release test into a simple integration test
- Adding MacOSX on Travis-ci
Tests: Adding tests for Plink w. LOCO
Safety: Introduce strtok_safe to get rid of segfaults
Diffstat (limited to 'src/debug.cpp')
-rw-r--r-- | src/debug.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index 6bd834e..82d2be0 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -72,6 +72,13 @@ gsl_vector *gsl_vector_safe_alloc(size_t n) { return v; } +char *do_strtok_safe(char *tokenize, const char *delimiters, const char *__pretty_function, const char *__file, int __line) { + auto token = strtok(tokenize,delimiters); + if (token == NULL && (is_debug_mode() || is_strict_mode())) + fail_at_msg(__file,__line,string("strtok failed in ") + __pretty_function); + return token; +} + // Helper function called by macro validate_K(K, check). K is validated // unless -no-check option is used. void do_validate_K(const gsl_matrix *K, const char *__file, int __line) { @@ -88,13 +95,13 @@ void do_validate_K(const gsl_matrix *K, const char *__file, int __line) { if (!isMatrixIllConditioned(eigenvalues)) warning_at_msg(__file,__line,"K is ill conditioned!"); if (!isMatrixSymmetric(K)) - fail_at_msg(is_strict_mode(),__file,__line,"K is not symmetric!" ); + warnfail_at_msg(is_strict_mode(),__file,__line,"K is not symmetric!" ); const bool negative_values = has_negative_values_but_one(eigenvalues); if (negative_values) { warning_at_msg(__file,__line,"K has more than one negative eigenvalues!"); } if (count_small>1 && negative_values && !isMatrixPositiveDefinite(K)) - fail_at_msg(is_strict_mode(),__file,__line,"K is not positive definite!"); + warnfail_at_msg(is_strict_mode(),__file,__line,"K is not positive definite!"); gsl_vector_free(eigenvalues); } } |