Deleted Added
full compact
cdefs.h (90792) cdefs.h (94334)
1/*
1/*
2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 * $Id: cdefs.h,v 1.14 2001/06/07 20:04:53 ca Exp $
9 * $Id: cdefs.h,v 1.15 2002/01/16 18:30:11 ca Exp $
10 */
11
12/*
13** libsm C language portability macros
14** See libsm/cdefs.html for documentation.
15*/
16
17#ifndef SM_CDEFS_H
18# define SM_CDEFS_H
19
20# include <sm/config.h>
21
22/*
23** BSD and Linux have <sys/cdefs.h> which defines a set of C language
24** portability macros that are a defacto standard in the open source
25** community.
26*/
27
28# if SM_CONF_SYS_CDEFS_H
29# include <sys/cdefs.h>
30# endif /* SM_CONF_SYS_CDEFS_H */
31
32/*
33** Define the standard C language portability macros
34** for platforms that lack <sys/cdefs.h>.
35*/
36
37# if !SM_CONF_SYS_CDEFS_H
38# if defined(__cplusplus)
39# define __BEGIN_DECLS extern "C" {
40# define __END_DECLS };
41# else /* defined(__cplusplus) */
42# define __BEGIN_DECLS
43# define __END_DECLS
44# endif /* defined(__cplusplus) */
45# if defined(__STDC__) || defined(__cplusplus)
10 */
11
12/*
13** libsm C language portability macros
14** See libsm/cdefs.html for documentation.
15*/
16
17#ifndef SM_CDEFS_H
18# define SM_CDEFS_H
19
20# include <sm/config.h>
21
22/*
23** BSD and Linux have <sys/cdefs.h> which defines a set of C language
24** portability macros that are a defacto standard in the open source
25** community.
26*/
27
28# if SM_CONF_SYS_CDEFS_H
29# include <sys/cdefs.h>
30# endif /* SM_CONF_SYS_CDEFS_H */
31
32/*
33** Define the standard C language portability macros
34** for platforms that lack <sys/cdefs.h>.
35*/
36
37# if !SM_CONF_SYS_CDEFS_H
38# if defined(__cplusplus)
39# define __BEGIN_DECLS extern "C" {
40# define __END_DECLS };
41# else /* defined(__cplusplus) */
42# define __BEGIN_DECLS
43# define __END_DECLS
44# endif /* defined(__cplusplus) */
45# if defined(__STDC__) || defined(__cplusplus)
46# define __P(protos) protos
46# ifndef __P
47# define __P(protos) protos
48# endif /* __P */
47# define __CONCAT(x,y) x ## y
48# define __STRING(x) #x
49# else /* defined(__STDC__) || defined(__cplusplus) */
50# define __P(protos) ()
51# define __CONCAT(x,y) x/**/y
52# define __STRING(x) "x"
53# define const
54# define signed
55# define volatile
56# endif /* defined(__STDC__) || defined(__cplusplus) */
57# endif /* !SM_CONF_SYS_CDEFS_H */
58
59/*
60** Define SM_DEAD, a macro used to declare functions that do not return
61** to their caller.
62*/
63
64# ifndef SM_DEAD
65# if __GNUC__ >= 2
66# if __GNUC__ == 2 && __GNUC_MINOR__ < 5
67# define SM_DEAD(proto) volatile proto
68# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
69# define SM_DEAD(proto) proto __attribute__((__noreturn__))
70# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
71# else /* __GNUC__ >= 2 */
72# define SM_DEAD(proto) proto
73# endif /* __GNUC__ >= 2 */
74# endif /* SM_DEAD */
75
76/*
77** Define SM_UNUSED, a macro used to declare variables that may be unused.
78*/
79
80# ifndef SM_UNUSED
81# if __GNUC__ >= 2
82# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
83# define SM_UNUSED(decl) decl
84# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
85# define SM_UNUSED(decl) decl __attribute__((__unused__))
86# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
87# else /* __GNUC__ >= 2 */
88# define SM_UNUSED(decl) decl
89# endif /* __GNUC__ >= 2 */
90# endif /* SM_UNUSED */
91
92/*
93** The SM_NONVOLATILE macro is used to declare variables that are not
94** volatile, but which must be declared volatile when compiling with
95** gcc -O -Wall in order to suppress bogus warning messages.
96**
97** Variables that actually are volatile should be declared volatile
98** using the "volatile" keyword. If a variable actually is volatile,
99** then SM_NONVOLATILE should not be used.
100**
101** To compile sendmail with gcc and see all non-bogus warnings,
102** you should use
103** gcc -O -Wall -DSM_OMIT_BOGUS_WARNINGS ...
104** Do not use -DSM_OMIT_BOGUS_WARNINGS when compiling the production
105** version of sendmail, because there is a performance hit.
106*/
107
108# ifdef SM_OMIT_BOGUS_WARNINGS
109# define SM_NONVOLATILE volatile
110# else /* SM_OMIT_BOGUS_WARNINGS */
111# define SM_NONVOLATILE
112# endif /* SM_OMIT_BOGUS_WARNINGS */
113
114/*
115** Turn on format string argument checking.
116*/
117
118# ifndef SM_CONF_FORMAT_TEST
119# if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
120# define SM_CONF_FORMAT_TEST 1
121# else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
122# define SM_CONF_FORMAT_TEST 0
123# endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
124# endif /* SM_CONF_FORMAT_TEST */
125
126# ifndef PRINTFLIKE
127# if SM_CONF_FORMAT_TEST
128# define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
129# else /* SM_CONF_FORMAT_TEST */
130# define PRINTFLIKE(x,y)
131# endif /* SM_CONF_FORMAT_TEST */
132# endif /* ! PRINTFLIKE */
133
134# ifndef SCANFLIKE
135# if SM_CONF_FORMAT_TEST
136# define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y)))
137# else /* SM_CONF_FORMAT_TEST */
138# define SCANFLIKE(x,y)
139# endif /* SM_CONF_FORMAT_TEST */
140# endif /* ! SCANFLIKE */
141
142#endif /* ! SM_CDEFS_H */
49# define __CONCAT(x,y) x ## y
50# define __STRING(x) #x
51# else /* defined(__STDC__) || defined(__cplusplus) */
52# define __P(protos) ()
53# define __CONCAT(x,y) x/**/y
54# define __STRING(x) "x"
55# define const
56# define signed
57# define volatile
58# endif /* defined(__STDC__) || defined(__cplusplus) */
59# endif /* !SM_CONF_SYS_CDEFS_H */
60
61/*
62** Define SM_DEAD, a macro used to declare functions that do not return
63** to their caller.
64*/
65
66# ifndef SM_DEAD
67# if __GNUC__ >= 2
68# if __GNUC__ == 2 && __GNUC_MINOR__ < 5
69# define SM_DEAD(proto) volatile proto
70# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
71# define SM_DEAD(proto) proto __attribute__((__noreturn__))
72# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
73# else /* __GNUC__ >= 2 */
74# define SM_DEAD(proto) proto
75# endif /* __GNUC__ >= 2 */
76# endif /* SM_DEAD */
77
78/*
79** Define SM_UNUSED, a macro used to declare variables that may be unused.
80*/
81
82# ifndef SM_UNUSED
83# if __GNUC__ >= 2
84# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
85# define SM_UNUSED(decl) decl
86# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
87# define SM_UNUSED(decl) decl __attribute__((__unused__))
88# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
89# else /* __GNUC__ >= 2 */
90# define SM_UNUSED(decl) decl
91# endif /* __GNUC__ >= 2 */
92# endif /* SM_UNUSED */
93
94/*
95** The SM_NONVOLATILE macro is used to declare variables that are not
96** volatile, but which must be declared volatile when compiling with
97** gcc -O -Wall in order to suppress bogus warning messages.
98**
99** Variables that actually are volatile should be declared volatile
100** using the "volatile" keyword. If a variable actually is volatile,
101** then SM_NONVOLATILE should not be used.
102**
103** To compile sendmail with gcc and see all non-bogus warnings,
104** you should use
105** gcc -O -Wall -DSM_OMIT_BOGUS_WARNINGS ...
106** Do not use -DSM_OMIT_BOGUS_WARNINGS when compiling the production
107** version of sendmail, because there is a performance hit.
108*/
109
110# ifdef SM_OMIT_BOGUS_WARNINGS
111# define SM_NONVOLATILE volatile
112# else /* SM_OMIT_BOGUS_WARNINGS */
113# define SM_NONVOLATILE
114# endif /* SM_OMIT_BOGUS_WARNINGS */
115
116/*
117** Turn on format string argument checking.
118*/
119
120# ifndef SM_CONF_FORMAT_TEST
121# if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
122# define SM_CONF_FORMAT_TEST 1
123# else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
124# define SM_CONF_FORMAT_TEST 0
125# endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
126# endif /* SM_CONF_FORMAT_TEST */
127
128# ifndef PRINTFLIKE
129# if SM_CONF_FORMAT_TEST
130# define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
131# else /* SM_CONF_FORMAT_TEST */
132# define PRINTFLIKE(x,y)
133# endif /* SM_CONF_FORMAT_TEST */
134# endif /* ! PRINTFLIKE */
135
136# ifndef SCANFLIKE
137# if SM_CONF_FORMAT_TEST
138# define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y)))
139# else /* SM_CONF_FORMAT_TEST */
140# define SCANFLIKE(x,y)
141# endif /* SM_CONF_FORMAT_TEST */
142# endif /* ! SCANFLIKE */
143
144#endif /* ! SM_CDEFS_H */