summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libsm/cdefs.html
blob: 33e45acfd3e625f068dda45ed20f68567961445d (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<html>
<head>
    <title>libsm : C Language Portability Macros</title>
</head>
<body>

<a href="index.html">Back to libsm overview</a>

<center>
    <h1> libsm : C Language Portability Macros </h1>
    <br> $Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $
</center>

<h2> Description </h2>

The header file <tt>&lt;sm/cdefs.h&gt;</tt>
defines portable interfaces to non-portable features
of various C compilers.
It also assists you in writing C header files that are compatible
with C++.

<dl>
<dt>
<tt> __P(parameterlist) </tt>
<dd>
    This macro is used to write portable function prototypes.
    For example,

<blockquote><pre>
int foo __P((int));
</pre></blockquote>

<dt>
<tt> __CONCAT(x,y) </tt>
<dd>
    This macro concatenates two tokens x and y,
    forming a single token xy.
    Warning: make sure there is no white space around the arguments x and y.
    <p>

<dt>
<tt> __STRING(x) </tt>
<dd>
    This macro converts the token sequence x into a string literal.
    <p>

<dt>
<tt> __BEGIN_DECLS, __END_DECLS </tt>
<dd>
    These macros are used to write C header files that are compatible
    with C++ compilers.
    Put <tt>__BEGIN_DECLS</tt> before the first function or variable
    declaration in your header file,
    and put <tt>__END_DECLS</tt> after the last function or variable
    declaration.
    <p>

<dt>
<tt> const, signed, volatile </tt>
<dd>
    For pre-ANSI C compilers, <tt>const</tt>, <tt>signed</tt>
    and <tt>volatile</tt> are defined as empty macros.
    This means you can use these keywords without introducing
    portability problems.
    <p>

<dt>
<tt> SM_DEAD(function_declaration) </tt>
<dd>
    This macro modifies a prototype of a function
    that does not return to its caller.
    With some versions of gcc, this will result in slightly better code,
    and can suppress some useless warnings produced by gcc -Wall.
    For example,

<blockquote><pre>
SM_DEAD(void exit __P((int)));
</pre></blockquote>

<dt>
<tt> SM_UNUSED(variable_declaration) </tt>
<dd>
    This macro modifies a definition of an unused
    local variable, global variable or function parameter
    in order to suppress compiler warnings.
    Examples:

<blockquote><pre>
SM_UNUSED(static const char Id[]) = "@(#)$Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $";
void
foo(x)
	SM_UNUSED(int x);
{
	SM_UNUSED(int y) = 0;
	return 0;
}
void
bar(SM_UNUSED(int x))
{
	return 0;
}
</pre></blockquote>

</dl>

</body>
</html>
OpenPOWER on IntegriCloud