You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
3.8 KiB
HTML

<html lang="en">
<head>
<title>Push/Pop Macro Pragmas - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Pragmas.html#Pragmas" title="Pragmas">
<link rel="prev" href="Visibility-Pragmas.html#Visibility-Pragmas" title="Visibility Pragmas">
<link rel="next" href="Function-Specific-Option-Pragmas.html#Function-Specific-Option-Pragmas" title="Function Specific Option Pragmas">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2015 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
``GNU Free Documentation License''.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Push%2fPop-Macro-Pragmas"></a>
<a name="Push_002fPop-Macro-Pragmas"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Function-Specific-Option-Pragmas.html#Function-Specific-Option-Pragmas">Function Specific Option Pragmas</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Visibility-Pragmas.html#Visibility-Pragmas">Visibility Pragmas</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Pragmas.html#Pragmas">Pragmas</a>
<hr>
</div>
<h4 class="subsection">6.60.12 Push/Pop Macro Pragmas</h4>
<p>For compatibility with Microsoft Windows compilers, GCC supports
&lsquo;<samp><span class="samp">#pragma push_macro(</span><var>"macro_name"</var><span class="samp">)</span></samp>&rsquo;
and &lsquo;<samp><span class="samp">#pragma pop_macro(</span><var>"macro_name"</var><span class="samp">)</span></samp>&rsquo;.
<dl>
<dt><code>#pragma push_macro(</code><var>"macro_name"</var><code>)</code><dd><a name="index-pragma_002c-push_005fmacro-4181"></a>This pragma saves the value of the macro named as <var>macro_name</var> to
the top of the stack for this macro.
<br><dt><code>#pragma pop_macro(</code><var>"macro_name"</var><code>)</code><dd><a name="index-pragma_002c-pop_005fmacro-4182"></a>This pragma sets the value of the macro named as <var>macro_name</var> to
the value on top of the stack for this macro. If the stack for
<var>macro_name</var> is empty, the value of the macro remains unchanged.
</dl>
<p>For example:
<pre class="smallexample"> #define X 1
#pragma push_macro("X")
#undef X
#define X -1
#pragma pop_macro("X")
int x [X];
</pre>
<p class="noindent">In this example, the definition of X as 1 is saved by <code>#pragma
push_macro</code> and restored by <code>#pragma pop_macro</code>.
</body></html>