1 #ifndef ERROR_H 2 #define ERROR_H 3 4 /** $MirOS: src/usr.bin/make/error.h,v 1.4 2013/10/31 20:07:06 tg Exp $ */ 5 /* $OpenBSD: error.h,v 1.7 2001/09/19 10:58:07 mpech Exp $ */ 6 7 /* 8 * Copyright © 2013 9 * Thorsten “mirabilos” Glaser <tg@mirbsd.org> 10 * Copyright (c) 2001 Marc Espie. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD 25 * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* Error Print a tagged error message. The global 35 * MAKE variable must have been defined. This 36 * takes a format string and two optional 37 * arguments for it. 38 * 39 * Fatal Print an error message and exit. Also takes 40 * a format string and two arguments. 41 * 42 * Punt Aborts all jobs and exits with a message. Also 43 * takes a format string and two arguments. 44 * 45 * Finish Finish things up by printing the number of 46 * errors which occurred, as passed to it, and 47 * exiting. 48 */ 49 50 extern void Error(const char *, ...) 51 __attribute__((__format__(__printf__, 1, 2))); 52 extern void Fatal(const char *, ...) 53 __attribute__((__noreturn__)) 54 __attribute__((__format__(__printf__, 1, 2))); 55 extern void Punt(const char *, ...) 56 __attribute__((__noreturn__)) 57 __attribute__((__format__(__printf__, 1, 2))); 58 extern void DieHorribly(void) 59 __attribute__((__noreturn__)); 60 extern void Finish(int) 61 __attribute__((__noreturn__)); 62 63 /* 64 * Error levels for parsing. PARSE_FATAL means the process cannot continue 65 * once the makefile has been parsed. PARSE_WARNING means it can. Passed 66 * as the first argument to Parse_Error. 67 */ 68 69 #define PARSE_WARNING 2 70 #define PARSE_FATAL 1 71 extern void Parse_Error(int, const char *, ...) 72 __attribute__((__format__(__printf__, 2, 3))); 73 extern int fatal_errors; 74 75 #endif 76