1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Copyright (C) 1992-2021 Free Software Foundation, Inc.
4Contributed by Cygnus Support.  Written by Julia Menapace, Jim Kingdon,
5and David MacKenzie.
6
7Permission is granted to copy, distribute and/or modify this document
8under the terms of the GNU Free Documentation License, Version 1.3 or
9any later version published by the Free Software Foundation; with no
10Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
11Texts.  A copy of the license is included in the section entitled "GNU
12Free Documentation License". -->
13<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
14<head>
15<title>STABS: Macro define and undefine</title>
16
17<meta name="description" content="STABS: Macro define and undefine">
18<meta name="keywords" content="STABS: Macro define and undefine">
19<meta name="resource-type" content="document">
20<meta name="distribution" content="global">
21<meta name="Generator" content="makeinfo">
22<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
23<link href="index.html#Top" rel="start" title="Top">
24<link href="Symbol-Types-Index.html#Symbol-Types-Index" rel="index" title="Symbol Types Index">
25<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
26<link href="index.html#Top" rel="up" title="Top">
27<link href="Symbol-Tables.html#Symbol-Tables" rel="next" title="Symbol Tables">
28<link href="Function-Types.html#Function-Types" rel="previous" title="Function Types">
29<style type="text/css">
30<!--
31a.summary-letter {text-decoration: none}
32blockquote.smallquotation {font-size: smaller}
33div.display {margin-left: 3.2em}
34div.example {margin-left: 3.2em}
35div.indentedblock {margin-left: 3.2em}
36div.lisp {margin-left: 3.2em}
37div.smalldisplay {margin-left: 3.2em}
38div.smallexample {margin-left: 3.2em}
39div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
40div.smalllisp {margin-left: 3.2em}
41kbd {font-style:oblique}
42pre.display {font-family: inherit}
43pre.format {font-family: inherit}
44pre.menu-comment {font-family: serif}
45pre.menu-preformatted {font-family: serif}
46pre.smalldisplay {font-family: inherit; font-size: smaller}
47pre.smallexample {font-size: smaller}
48pre.smallformat {font-family: inherit; font-size: smaller}
49pre.smalllisp {font-size: smaller}
50span.nocodebreak {white-space:nowrap}
51span.nolinebreak {white-space:nowrap}
52span.roman {font-family:serif; font-weight:normal}
53span.sansserif {font-family:sans-serif; font-weight:normal}
54ul.no-bullet {list-style: none}
55-->
56</style>
57
58
59</head>
60
61<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
62<a name="Macro-define-and-undefine"></a>
63<div class="header">
64<p>
65Next: <a href="Symbol-Tables.html#Symbol-Tables" accesskey="n" rel="next">Symbol Tables</a>, Previous: <a href="Types.html#Types" accesskey="p" rel="previous">Types</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Types-Index.html#Symbol-Types-Index" title="Index" rel="index">Index</a>]</p>
66</div>
67<hr>
68<a name="Representation-of-_0023define-and-_0023undef"></a>
69<h2 class="chapter">6 Representation of #define and #undef</h2>
70
71<p>This section describes the stabs support for macro define and undefine
72information, supported on some systems.  (e.g., with <samp>-g3</samp>
73<samp>-gstabs</samp> when using GCC).
74</p>
75<p>A <code>#define <var>macro-name</var> <var>macro-body</var></code> is represented with
76an <code>N_MAC_DEFINE</code> stab with a string field of
77<code><var>macro-name</var> <var>macro-body</var></code>.
78<a name="index-N_005fMAC_005fDEFINE"></a>
79</p>
80<p>An <code>#undef <var>macro-name</var></code> is represented with an
81<code>N_MAC_UNDEF</code> stabs with a string field of simply
82<code><var>macro-name</var></code>.
83<a name="index-N_005fMAC_005fUNDEF"></a>
84</p>
85<p>For both <code>N_MAC_DEFINE</code> and <code>N_MAC_UNDEF</code>, the desc field is
86the line number within the file where the corresponding <code>#define</code>
87or <code>#undef</code> occurred.
88</p>
89<p>For example, the following C code:
90</p>
91<div class="example">
92<pre class="example">    #define NONE	42
93    #define TWO(a, b)	(a + (a) + 2 * b)
94    #define ONE(c)	(c + 19)
95
96    main(int argc, char *argv[])
97    {
98      func(NONE, TWO(10, 11));
99      func(NONE, ONE(23));
100
101    #undef ONE
102    #define ONE(c)	(c + 23)
103
104      func(NONE, ONE(-23));
105
106      return (0);
107    }
108
109    int global;
110
111    func(int arg1, int arg2)
112    {
113      global = arg1 + arg2;
114    }
115</pre></div>
116
117<p>produces the following stabs (as well as many others):
118</p>
119<div class="example">
120<pre class="example">    .stabs	&quot;NONE 42&quot;,54,0,1,0
121    .stabs	&quot;TWO(a,b) (a + (a) + 2 * b)&quot;,54,0,2,0
122    .stabs	&quot;ONE(c) (c + 19)&quot;,54,0,3,0
123    .stabs	&quot;ONE&quot;,58,0,10,0
124    .stabs	&quot;ONE(c) (c + 23)&quot;,54,0,11,0
125</pre></div>
126
127<p>NOTE: In the above example, <code>54</code> is <code>N_MAC_DEFINE</code> and
128<code>58</code> is <code>N_MAC_UNDEF</code>.
129</p>
130
131
132
133</body>
134</html>
135