From c11fe19af32733241cf8ab0e819e444af4224c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Tue, 28 Jan 2020 18:10:52 +0200 Subject: [PATCH] Remove build type hardcode spec. Also add QPMS_NORETURN attribute/macro. Former-commit-id: 0a3fa2ecb35e8ffcee698c98553577ab2bb513b0 --- CMakeLists.txt | 2 -- qpms/optim.h | 6 ++++++ qpms/qpms_error.h | 4 ++-- qpms/tmatrices.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f80c81..84410d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,6 @@ include(GNUInstallDirs) project (QPMS) -set(CMAKE_BUILD_TYPE Debug) - macro(use_c99) if (CMAKE_VERSION VERSION_LESS "3.1") if (CMAKE_C_COMPILER_ID STREQUAL "GNU") diff --git a/qpms/optim.h b/qpms/optim.h index 44e14c8..6484700 100644 --- a/qpms/optim.h +++ b/qpms/optim.h @@ -19,4 +19,10 @@ #define QPMS_EXPECT(exp,c) (exp) #endif +#if (defined(__GNUC__) && __GNUC__ >= 3) || \ + (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 8) +// TODO clang +#define QPMS_NORETURN __attribute__((noreturn)) +#endif + #endif // OPTIM_H diff --git a/qpms/qpms_error.h b/qpms/qpms_error.h index 6c46793..e40e105 100644 --- a/qpms/qpms_error.h +++ b/qpms/qpms_error.h @@ -4,14 +4,14 @@ #include "optim.h" /// Provisional error message with abort(); -void qpms_pr_error(const char *fmt, ...); +QPMS_NORETURN void qpms_pr_error(const char *fmt, ...); //void qpms_error(const char *fmt, ...); /// Provisional error message with abort(), indicating source and line number. void qpms_pr_error_at_line(const char *filename, unsigned int linenum, const char *fmt, ...); -void qpms_pr_error_at_flf(const char *filename, unsigned int linenum, +QPMS_NORETURN void qpms_pr_error_at_flf(const char *filename, unsigned int linenum, const char *func, const char *fmt, ...); diff --git a/qpms/tmatrices.c b/qpms/tmatrices.c index 7d21a5c..87f262e 100644 --- a/qpms/tmatrices.c +++ b/qpms/tmatrices.c @@ -429,12 +429,12 @@ qpms_errno_t qpms_read_scuff_tmatrix( switch(PAlpha) { case 0: TAlpha = QPMS_VSWF_MAGNETIC; break; case 1: TAlpha = QPMS_VSWF_ELECTRIC; break; - default: assert(0); + default: QPMS_WTF; } switch(PBeta) { case 0: TBeta = QPMS_VSWF_MAGNETIC; break; case 1: TBeta = QPMS_VSWF_ELECTRIC; break; - default: assert(0); + default: QPMS_WTF; } qpms_uvswfi_t srcui = qpms_tmn2uvswfi(TAlpha, MAlpha, LAlpha), destui = qpms_tmn2uvswfi(TBeta, MBeta, LBeta);