From 44896c0cb1d21c5345c8ead1c241727012f26cb8 Mon Sep 17 00:00:00 2001 From: hasufell Date: Thu, 5 Jun 2014 19:12:13 +0200 Subject: [PATCH] ERR: add more error/warning macros --- src/ntru_err.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ntru_err.h b/src/ntru_err.h index bac621c..a6e9078 100644 --- a/src/ntru_err.h +++ b/src/ntru_err.h @@ -29,10 +29,32 @@ #ifndef NTRU_ERR_H #define NTRU_ERR_H + #define NTRU_ABORT(...) \ { \ fprintf(stderr, __VA_ARGS__); \ abort(); \ } +#define NTRU_ABORT_DEBUG(...) \ +{ \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, " [file %s, line %d]:\n", \ + __FILE__, __LINE__); \ + abort(); \ +} + +#define NTRU_WARN(...) \ +{ \ + fprintf(stderr, __VA_ARGS__); \ +} + +#define NTRU_WARN_DEBUG(...) \ +{ \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, " [file %s, line %d]:\n", \ + __FILE__, __LINE__); \ +} + + #endif /* NTRU_ERR_H */