1 #ifndef DEFINES_H 2 #define DEFINES_H 3 4 /* $OpenBSD: defines.h,v 1.10 2012/03/22 13:47:12 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 Location_; 44 typedef struct Location_ Location; 45 46 struct List_; 47 typedef struct List_ *Lst; 48 49 struct SymTable_; 50 typedef struct SymTable_ SymTable; 51 52 struct Buffer_; 53 typedef struct Buffer_ *Buffer; 54 55 struct Name; 56 57 struct ListNode_; 58 typedef struct ListNode_ *LstNode; 59 60 /* some useful defines for gcc */ 61 62 #ifdef __GNUC__ 63 # define UNUSED __attribute__((__unused__)) 64 # define HAS_INLINES 65 # define INLINE __inline__ 66 #else 67 # define UNUSED 68 #endif 69 70 #ifdef HAS_INLINES 71 # ifndef INLINE 72 # define INLINE inline 73 # endif 74 #endif 75 76 /* 77 * debug control: 78 * There is one bit per module. It is up to the module what debug 79 * information to print. 80 */ 81 extern int debug; 82 #define DEBUG_ARCH 0x0001 83 #define DEBUG_COND 0x0002 84 #define DEBUG_DIR 0x0004 85 #define DEBUG_GRAPH1 0x0008 86 #define DEBUG_GRAPH2 0x0010 87 #define DEBUG_JOB 0x0020 88 #define DEBUG_MAKE 0x0040 89 #define DEBUG_SUFF 0x0080 90 #define DEBUG_TARG 0x0100 91 #define DEBUG_VAR 0x0200 92 #define DEBUG_FOR 0x0400 93 #define DEBUG_LOUD 0x0800 94 #define DEBUG_JOBBANNER 0x1000 95 #define DEBUG_PARALLEL 0x2000 96 #define DEBUG_NAME_MATCHING 0x4000 97 98 #define CONCAT(a,b) a##b 99 100 #define DEBUG(module) (debug & CONCAT(DEBUG_,module)) 101 102 #endif 103