Boost C++ Libraries: Ticket #7389: __STDC_LIMIT_MACROS can be redefined by boost when using mingw32 https://svn.boost.org/trac10/ticket/7389 <p> On Windows, compiling with mingw32, <span class="underline">STDC_LIMIT_MACROS macro is redefined if it was already defined. </span></p> <p> This macro is defined in boost/config/platform/win32.hpp by </p> <pre class="wiki">#if defined(__MINGW32__) &amp;&amp; ((__MINGW32_MAJOR_VERSION &gt; 2) || ((__MINGW32_MAJOR_VERSION == 2) &amp;&amp; (__MINGW32_MINOR_VERSION &gt;= 0))) # define BOOST_HAS_STDINT_H # define __STDC_LIMIT_MACROS # define BOOST_HAS_DIRENT_H # define BOOST_HAS_UNISTD_H #endif </pre><p> Maybe it can be changed to: </p> <pre class="wiki">#if defined(__MINGW32__) &amp;&amp; ((__MINGW32_MAJOR_VERSION &gt; 2) || ((__MINGW32_MAJOR_VERSION == 2) &amp;&amp; (__MINGW32_MINOR_VERSION &gt;= 0))) # define BOOST_HAS_STDINT_H # if !defined(__STDC_LIMIT_MACROS) # define __STDC_LIMIT_MACROS # endif # define BOOST_HAS_DIRENT_H # define BOOST_HAS_UNISTD_H #endif </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7389 Trac 1.4.3 viboes Tue, 18 Sep 2012 16:52:44 GMT component changed; owner set https://svn.boost.org/trac10/ticket/7389#comment:1 https://svn.boost.org/trac10/ticket/7389#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">John Maddock</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">config</span> </li> </ul> Ticket Paweł Bylica <chfast@…> Wed, 03 Oct 2012 09:06:58 GMT attachment set https://svn.boost.org/trac10/ticket/7389 https://svn.boost.org/trac10/ticket/7389 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">win32.hpp.patch</span> </li> </ul> <p> A patch </p> Ticket viboes Mon, 29 Oct 2012 02:25:51 GMT description changed https://svn.boost.org/trac10/ticket/7389#comment:2 https://svn.boost.org/trac10/ticket/7389#comment:2 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/7389?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket John Maddock Tue, 19 Feb 2013 13:15:43 GMT <link>https://svn.boost.org/trac10/ticket/7389#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7389#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82998" title="Fix for __STDC_LIMIT_MACROS already defined. Refs #7389.">[82998]</a>) Fix for <span class="underline">STDC_LIMIT_MACROS already defined. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7389" title="#7389: Bugs: __STDC_LIMIT_MACROS can be redefined by boost when using mingw32 (closed: fixed)">#7389</a>. </span></p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 19 Feb 2013 22:02:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7389#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7389#comment:4</guid> <description> <p> Why do we need to define </p> <pre class="wiki">__STDC_LIMIT_MACROS </pre><p> ? </p> <p> What happens if the user include the files using this macro before the boost config files? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 20 Feb 2013 09:08:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7389#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7389#comment:5</guid> <description> <blockquote class="citation"> <p> What happens if the user include the files using this macro before the boost config files? </p> </blockquote> <p> We have to fall back to code that doesn't depend on UINT8_MAX etc being defined. Ideally if stdint.h is included twice - once without <code>__STDC_LIMIT_MACROS</code> and then again with it, it will do the right thing and fill in the definitions it missed out the first time. Not all implementations do that though :-( </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 20 Feb 2013 18:08:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7389#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7389#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/7389#comment:5" title="Comment 5">anonymous</a>: </p> <blockquote class="citation"> <blockquote class="citation"> <p> What happens if the user include the files using this macro before the boost config files? </p> </blockquote> <p> We have to fall back to code that doesn't depend on UINT8_MAX etc being defined. Ideally if stdint.h is included twice - once without <code>__STDC_LIMIT_MACROS</code> and then again with it, it will do the right thing and fill in the definitions it missed out the first time. Not all implementations do that though :-( </p> </blockquote> <p> Isn't stdint.h protected for multiple inclusions? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 20 Feb 2013 18:42:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7389#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7389#comment:7</guid> <description> <blockquote class="citation"> <p> Isn't stdint.h protected for multiple inclusions? </p> </blockquote> <p> Maybe! </p> <p> In C99 it defines different things depending on whether <code>__STDC_LIMIT_MACROS</code> is defined or not, so rather like assert.h with <code>NDEBUG</code> it should really "correct itself" each time it's included depending upon the value of the macro. Thankfully C++11 does the sane thing and just requires that the limit macros are always defined. </p> <p> Either way, we should really try to get the system defined limits macros if we can, just because we can't be certain of getting them every time, isn't a reason not to try. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 21 Feb 2013 06:18:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7389#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7389#comment:8</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/7389#comment:7" title="Comment 7">anonymous</a>: </p> <blockquote class="citation"> <blockquote class="citation"> <p> Isn't stdint.h protected for multiple inclusions? </p> </blockquote> <p> Maybe! </p> <p> In C99 it defines different things depending on whether <code>__STDC_LIMIT_MACROS</code> is defined or not, so rather like assert.h with <code>NDEBUG</code> it should really "correct itself" each time it's included depending upon the value of the macro. Thankfully C++11 does the sane thing and just requires that the limit macros are always defined. </p> </blockquote> <p> Thanks for the explanation, I didn't know about this requirement. </p> <blockquote class="citation"> <p> Either way, we should really try to get the system defined limits macros if we can, just because we can't be certain of getting them every time, isn't a reason not to try. </p> </blockquote> <p> Agreed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sun, 24 Feb 2013 19:08:04 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7389#comment:9 https://svn.boost.org/trac10/ticket/7389#comment:9 <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/83139" title="Merge changes from Trunk. Fixes #6013. Fixes #7151. Fixes #7359. Fixes ...">[83139]</a>) Merge changes from Trunk. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6013" title="#6013: Patches: endian.hpp header patch to utilize OpenBSD's endian header (closed: fixed)">#6013</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7151" title="#7151: Bugs: config.hpp does not define BOOST_HAS_TR1_TUPLE (closed: fixed)">#7151</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7359" title="#7359: Bugs: Compatibility with Intel icpc 13.0 when using -use-clang-env option on ... (closed: fixed)">#7359</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7389" title="#7389: Bugs: __STDC_LIMIT_MACROS can be redefined by boost when using mingw32 (closed: fixed)">#7389</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7452" title="#7452: Patches: Compiling Boost.Asio Example Error [with Clang compiled by MinGW gcc] (closed: fixed)">#7452</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7528" title="#7528: Bugs: Compilation failure on Android and Xbox 360 (closed: fixed)">#7528</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7703" title="#7703: Bugs: endian.hpp for QNX / BlackBerry10 (closed: fixed)">#7703</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7841" title="#7841: Feature Requests: A macro to detect real GCC (closed: fixed)">#7841</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7898" title="#7898: Bugs: TI compiller: wrong decision about type_info presence in boost/config (closed: fixed)">#7898</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7938" title="#7938: Patches: Support vxWorks (closed: fixed)">#7938</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8048" title="#8048: Bugs: Boost 1.53 + GCC 4.6.3 __int128 undefined. (closed: fixed)">#8048</a>. </p> Ticket