File: kludge.h

package info (click to toggle)
libdbd-informix-perl 2003.04-3
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k, sarge
  • size: 1,232 kB
  • ctags: 467
  • sloc: perl: 7,349; ansic: 5,340; sh: 184; makefile: 58
file content (75 lines) | stat: -rw-r--r-- 2,164 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
@(#)Purpose:         Provide support for KLUDGE macro
@(#)Author:          J Leffler
@(#)Copyright:       1995,1997-99 Jonathan Leffler (JLSS)
@(#)Copyright:       2002         IBM
@(#)Product:         IBM Informix Database Driver for Perl Version 2003.04 (2003-03-05)
*/

/*TABSTOP=4*/

#ifndef KLUDGE_H
#define KLUDGE_H

#ifdef MAIN_PROGRAM
#ifndef lint
static const char kludge_h[] = "@(#)$Id: kludge.h,v 100.1 2002/02/08 22:49:29 jleffler Exp $";
#endif	/* lint */
#endif	/* MAIN_PROGRAM */

/*
 * The KLUDGE macro is enabled by default.
 * It can be disabled by specifying -DKLUDGE_DISABLE
 */

#ifdef KLUDGE_DISABLE

#define KLUDGE(x)	((void)0)
#define FEATURE(x)	((void)0)

#else

/*
 * The Solaris C compiler without either -O or -g removes unreferenced
 * strings, which defeats the purpose of the KLUDGE macro.  With such
 * compilers, use -DKLUDGE_FORCE to force the variable to be used.
 */

#ifdef lint
#define KLUDGE_FORCE
#endif /* lint */

/*
** The GNU C Compiler will complain about unused variables if told to
** do so.  Setting KLUDGE_FORCE ensures that it doesn't complain about
** any kludges.  On the other hand, it is better to leave kludges
** visible during the compilation, so don't set KLUDGE_FORCE if
** __GNUC__ is defined.
*/

/*
 * Example use: KLUDGE("Fix macro to accept arguments with commas");
 * Note that the argument is now a string.  An alternative (and
 * previously used) design is to have the argument as a non-string:
 *              KLUDGE(Fix macro to accept arguments with commas);
 * This allows it to work with traditional compilers but runs foul of
 * the absence of string concatenation, and you have to avoid commas
 * in the reason string, etc.
 */

#define KLUDGE_DEC	static const char kludge[]
#define FEATURE_DEC	static const char feature[]

extern void kludge_use(const char *str);
#define KLUDGE(x)	{ KLUDGE_DEC = "@(#)KLUDGE: " x; KLUDGE_USE(kludge); }
#define FEATURE(x)	{ FEATURE_DEC = "@(#)Feature: " x; KLUDGE_USE(kludge); }

#ifdef KLUDGE_FORCE
#define KLUDGE_USE(x)	kludge_use(x)
#else
#define KLUDGE_USE(x)	((void)0)
#endif /* KLUDGE_FORCE */

#endif /* KLUDGE_DISABLE */

#endif /* KLUDGE_H */