1 #ifndef DEFINES_H 2 #define DEFINES_H 3 4 /* $OpenBSD: defines.h,v 1.9 2010/07/19 19:46:44 espie Exp $ */ 5 6 /* 7 * Copyright (c) 2001 Marc Espie. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD 22 * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifdef HAS_STDBOOL_H 32 # include <stdbool.h> 33 #else 34 typedef int bool; 35 # define false 0 36 # define true 1 37 #endif 38 39 /* define common types in an opaque way */ 40 struct GNode_; 41 typedef struct GNode_ GNode; 42 43 struct List_; 44 typedef struct List_ *Lst; 45 46 struct SymTable_; 47 typedef struct SymTable_ SymTable; 48 49 struct Buffer_; 50 typedef struct Buffer_ *Buffer; 51 52 struct Name; 53 54 struct ListNode_; 55 typedef struct ListNode_ *LstNode; 56 57 /* some useful defines for gcc */ 58 59 #ifdef __GNUC__ 60 # define UNUSED __attribute__((__unused__)) 61 # define HAS_INLINES 62 # define INLINE __inline__ 63 #else 64 # define UNUSED 65 #endif 66 67 #ifdef HAS_INLINES 68 # ifndef INLINE 69 # define INLINE inline 70 # endif 71 #endif 72 73 /* 74 * debug control: 75 * There is one bit per module. It is up to the module what debug 76 * information to print. 77 */ 78 extern int debug; 79 #define DEBUG_ARCH 0x0001 80 #define DEBUG_COND 0x0002 81 #define DEBUG_DIR 0x0004 82 #define DEBUG_GRAPH1 0x0008 83 #define DEBUG_GRAPH2 0x0010 84 #define DEBUG_JOB 0x0020 85 #define DEBUG_MAKE 0x0040 86 #define DEBUG_SUFF 0x0080 87 #define DEBUG_TARG 0x0100 88 #define DEBUG_VAR 0x0200 89 #define DEBUG_FOR 0x0400 90 #define DEBUG_LOUD 0x0800 91 #define DEBUG_JOBBANNER 0x1000 92 #define DEBUG_PARALLEL 0x2000 93 #define DEBUG_NAME_MATCHING 0x4000 94 95 #define CONCAT(a,b) a##b 96 97 #define DEBUG(module) (debug & CONCAT(DEBUG_,module)) 98 99 #endif 100