Boost C++ Libraries: Ticket #5870: The warning stack is not maintained https://svn.boost.org/trac10/ticket/5870 <h3 class="section" id="Problem">Problem</h3> <p> When "#include" is executed for the following file, the warning stack is destroyed. The cause is a misuse of "#pragma warning(default: warning-number-list)". </p> <p> File list </p> <ul><li>boost/test/utils/nullstream.hpp </li><li>boost/test/utils/iterator/ifstream_line_iterator.hpp </li></ul><h3 class="section" id="Impact">Impact</h3> <p> When the <a class="missing wiki">VisualStudio</a> user uses a specific header, a part of a necessary warning is not displayed. </p> <h3 class="section" id="Reproductioncode">Reproduction code</h3> <div class="wiki-code"><div class="code"><pre> <span class="cp">#include</span> <span class="cpf">&lt;boost/config.hpp&gt;</span><span class="cp"></span> <span class="cp">#pragma warning(error: 4193)</span> <span class="c1">//boost/test/utils/nullstream.hpp</span> <span class="cp">#pragma warning(pop) </span><span class="c1">// =&gt; warning C4193</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/utils/nullstream.hpp&gt;</span><span class="cp"></span> <span class="cp">#pragma warning(pop) </span><span class="c1">// !!! There is not warning. !!!</span> <span class="c1">//boost/test/utils/iterator/ifstream_line_iterator.hpp</span> <span class="cp">#pragma warning(pop) </span><span class="c1">// =&gt; warning C4193</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/utils/iterator/ifstream_line_iterator.hpp&gt;</span><span class="cp"></span> <span class="cp">#pragma warning(pop) </span><span class="c1">// !!! There is not warning. !!!</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><h3 class="section" id="Patch">Patch</h3> <div class="wiki-code"> <div class="diff"> <ul class="entries"> <li class="entry"> <h2> <a>boost/test/utils/iterator/ifstream_line_iterator.hpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="File boost/test/utils/iterator/ifstream_line_iterator.hpp (revision 74236)"> </th> <th title="File boost/test/utils/iterator/ifstream_line_iterator.hpp (working copy)"> </th> <td> <em></em> &nbsp; </td> </tr> </thead> <tbody class="unmod"> <tr> <th>86</th><th>86</th><td class="l"><span>};</span></td> </tr> <tr> <th>87</th><th>87</th><td class="l"><span></span></td> </tr> <tr> <th>88</th><th>88</th><td class="l"><span>#ifdef BOOST_MSVC</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>89</th><th>&nbsp;</th><td class="l"><span># pragma warning(<del>default: 4355</del>)</span></td> </tr> <tr class="last"> <th>&nbsp;</th><th>89</th><td class="r"><span># pragma warning(<ins>pop</ins>)</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>90</th><th>90</th><td class="l"><span>#endif</span></td> </tr> <tr> <th>91</th><th>91</th><td class="l"><span></span></td> </tr> <tr> <th>92</th><th>92</th><td class="l"><span>typedef basic_ifstream_line_iterator&lt;char&gt;&nbsp; &nbsp; &nbsp; ifstream_line_iterator;</span></td> </tr> </tbody> </table> </li> <li class="entry"> <h2> <a>boost/test/utils/nullstream.hpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="File boost/test/utils/nullstream.hpp (revision 74236)"> </th> <th title="File boost/test/utils/nullstream.hpp (working copy)"> </th> <td> <em></em> &nbsp; </td> </tr> </thead> <tbody class="unmod"> <tr> <th>85</th><th>85</th><td class="l"><span>};</span></td> </tr> <tr> <th>86</th><th>86</th><td class="l"><span></span></td> </tr> <tr> <th>87</th><th>87</th><td class="l"><span>#ifdef BOOST_MSVC</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>88</th><th>&nbsp;</th><td class="l"><span># pragma warning(<del>default: 4355</del>)</span></td> </tr> <tr class="last"> <th>&nbsp;</th><th>88</th><td class="r"><span># pragma warning(<ins>pop</ins>)</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>89</th><th>89</th><td class="l"><span>#endif</span></td> </tr> <tr> <th>90</th><th>90</th><td class="l"><span></span></td> </tr> <tr> <th>91</th><th>91</th><td class="l"><span>typedef basic_onullstream&lt;char&gt;&nbsp; &nbsp; &nbsp; onullstream;</span></td> </tr> </tbody> </table> </li> </ul> </div></div><h3 class="section" id="Environment">Environment</h3> <ul><li>OS: Windows 7 Professional SP1 </li><li>Compiler: <pre class="wiki">Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel Microsoft .NET Framework Version 4.0.30319 RTMRel </pre></li></ul><h3 class="section" id="Comments">Comments</h3> <p> Division origin <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5577" title="#5577: Bugs: The warning stack is not maintained (closed: invalid)">#5577</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5870 Trac 1.4.3 Gennadiy Rozental Tue, 18 Oct 2011 09:30:01 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5870#comment:1 https://svn.boost.org/trac10/ticket/5870#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/75037" title="Added missing &#34; # pragma warning(pop) &#34; Fixes #5870">[75037]</a>) Added missing " # pragma warning(pop) " Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5870" title="#5870: Bugs: The warning stack is not maintained (closed: fixed)">#5870</a> </p> Ticket Raffi Enficiaud Tue, 07 Jul 2015 08:25:53 GMT milestone changed https://svn.boost.org/trac10/ticket/5870#comment:2 https://svn.boost.org/trac10/ticket/5870#comment:2 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> Ticket