per test
[rattatechess.git] / compiler.h
blob6920a6b447d108b5ff7fb82fb1986a0ca3b6f4ad
1 /***************************************************************************
2 compiler.h - compiler-dependent definitions
3 -------------------
4 begin : mer ott 18 2005
5 copyright : (C) 2005-2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef __COMPILER_H__
19 #define __COMPILER_H__
21 #include <stdlib.h>
23 #ifdef __GNUC__
25 #define PACKED __attribute__((packed))
26 #define ALIGN(x) __attribute__((aligned (x)))
27 #define PRINTF(x,y) __attribute__ ((__format__ (__printf__, x, y)))
29 #define TRAP asm("int $0x03\n\t")
31 #ifdef DEBUG
33 #define ASSERT(x) ({if(!(x)){ printf("Assertion " #x " failed\n" \
34 "in %s, line %d of file %s\n", __PRETTY_FUNCTION__, \
35 __LINE__, __FILE__); system("kdialog --error 'Crash!'"); TRAP; }; 0;})
36 #else //DEBUG
38 #define ASSERT(x) ({})
39 #endif //DEBUG
41 #else
43 #define PACKED
44 #define ALIGN(x)
45 #define PRINTF(x,y)
46 #define TRAP
47 #define ASSERT(x)
49 #endif //0
51 #endif //__COMPILER_H__