1 /* Jitter: fatal error functions. 2 3 Copyright (C) 2017 Luca Saiu 4 Written by Luca Saiu 5 6 This file is part of Jitter. 7 8 Jitter is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 Jitter is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with Jitter. If not, see <http://www.gnu.org/licenses/>. */ 20 21 22 #ifndef JITTER_FATAL_H_ 23 #define JITTER_FATAL_H_ 24 25 #include <stdio.h> 26 #include <stdbool.h> 27 #include <stdlib.h> 28 29 30 /* Fatal error reporting. 31 * ************************************************************************** */ 32 33 #define jitter_fatal(...) \ 34 do \ 35 { \ 36 /* Ignore any failures in printing a fatal error message. */ \ 37 printf ("FATAL ERROR: " __VA_ARGS__); \ 38 printf ("\n"); \ 39 exit (EXIT_FAILURE); \ 40 } \ 41 while (false) 42 43 #define jitter_unimplemented(message) \ 44 do \ 45 { \ 46 jitter_fatal ("%s:%i: %s: unimplemented", __FILE__, __LINE__, message); \ 47 } \ 48 while (false) 49 50 #endif // #ifndef JITTER_FATAL_H_ 51