Boost C++ Libraries: Ticket #3931: Build boost libraries under HP-UX with GNU C/C++ https://svn.boost.org/trac10/ticket/3931 <p> I tried build boost, with program_options, under HP-UX (B.11.23 U ia64) with GNU C/C++ compiler version 4.3.1, using bjam. I fpund a problem with the define WCHAR_MAX in the system headers of HP-UX, it is defined there with type cast, and an error arrives in the build:<br /> </p> <p> In file included from libs/program_options/src/utf8_codecvt_facet.cpp:15: libs/program_options/src/../../detail/utf8_codecvt_facet.cpp:255:7: error: missing binary operator before token "("<br /> </p> <p> The problematic define is in the system wchar.h:<br /> # if defined(_INCLUDE_STDC<span class="underline">SOURCE_199901)<br /> # define WCHAR_MAX UINT_MAX /* max value of an unsigned integer */<br /> # define WCHAR_MIN 0<br /> # else<br /> <strong># define WCHAR_MAX (wchar_t)UINT_MAX /* max value of an unsigned integer */<br /> # define WCHAR_MIN (wchar_t)0</strong><br /> # endif<br /> </span></p> <p> I fixed the problem with a little modification of libs/detail/utf8_codecvt_facet.cpp, I replaced <br /> #if defined(_MSC_VER) &amp;&amp; _MSC_VER &lt;= 1310 <em> 7.1 or earlier<br /> </em></p> <blockquote> <p> return 2;<br /> </p> </blockquote> <p> #elif WCHAR_MAX &gt; 0x10000<br /> </p> <blockquote> <p> if (word &lt; 0x10000) {<br /> </p> <blockquote> <p> return 2;<br /> </p> </blockquote> <p> }<br /> if (word &lt; 0x200000) {<br /> </p> <blockquote> <p> return 3;<br /> </p> </blockquote> <p> }<br /> if (word &lt; 0x4000000) {<br /> </p> <blockquote> <p> return 4;<br /> </p> </blockquote> <p> }<br /> return 5;<br /> </p> </blockquote> <p> #else<br /> </p> <blockquote> <p> return 2;<br /> </p> </blockquote> <p> #endif<br /> </p> <p> with this one<br /> #if defined(_MSC_VER) &amp;&amp; _MSC_VER &lt;= 1310 <em> 7.1 or earlier<br /> </em></p> <blockquote> <p> return 2;<br /> </p> </blockquote> <p> #else<br /> </p> <blockquote> <p> if (WCHAR_MAX &gt; 0x10000) {<br /> </p> <blockquote> <p> if (word &lt; 0x10000) {<br /> </p> <blockquote> <p> return 2;<br /> </p> </blockquote> <p> }<br /> if (word &lt; 0x200000) {<br /> </p> <blockquote> <p> return 3;<br /> </p> </blockquote> <p> }<br /> if (word &lt; 0x4000000) {<br /> </p> <blockquote> <p> return 4;<br /> </p> </blockquote> <p> }<br /> return 5;<br /> </p> </blockquote> <p> } <br /> else { <br /> </p> <blockquote> <blockquote> <p> return 2;<br /> </p> </blockquote> </blockquote> <p> } <br /> </p> </blockquote> <p> #endif<br /> </p> <p> The comparision WCHAR_MAX &gt; 0x10000 will be done on runtime, and not at compile time, but on runtime the type cast is ok.<br /> </p> <p> Regards,<br /> Vladimir Penev </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3931 Trac 1.4.3 Vladimir Prus Sat, 06 Mar 2010 08:34:39 GMT <link>https://svn.boost.org/trac10/ticket/3931#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3931#comment:1</guid> <description> <p> This is compiler bug, I think. Per C standard, 7.18.3/2 </p> <pre class="wiki">Each instance of these macros shall be replaced by a constant expression suitable for use in #if preprocessing directives </pre><p> It is unclear to me if gcc or HP-UX is at fault, so the best course of action would be to figure who's at fault, figure what is the best resolution (presumably just removing the cast), and then, maybe, applying that resolution inside Boost.Config. </p> <p> Would you be willing to follow up with gcc/HP-UX folks? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 11 Mar 2010 11:32:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3931#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3931#comment:2</guid> <description> <p> Hello Vladimir, </p> <blockquote class="citation"> <p> It is unclear to me if gcc or HP-UX is at fault, so the best course of action would be to figure who's at fault, figure what is the best resolution (presumably just removing the cast), and then, maybe, applying that resolution inside Boost.Config. </p> </blockquote> <p> At my point HP-UX has bad define, and they have change their header according the C standard. </p> <blockquote class="citation"> <p> Would you be willing to follow up with gcc/HP-UX folks? </p> </blockquote> <p> I'm not sure that I would have discussion with, or waiting something from, HP-UX folks... </p> <p> Regards, Vladimir Penev </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Thu, 11 Mar 2010 11:35:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3931#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3931#comment:3</guid> <description> <p> I probably was unclear. This is HP-UX bug, in my opinion. Can you report it to them and see what they have to say, before we do anything further? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 11 Mar 2010 14:35:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3931#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3931#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/3931#comment:3" title="Comment 3">vladimir_prus</a>: </p> <blockquote class="citation"> <p> I probably was unclear. This is HP-UX bug, in my opinion. Can you report it to them and see what they have to say, before we do anything further? </p> </blockquote> <p> Sorry, but I can't report it to them, not at this moment ... if you have some way to connect with HP-UX, may be using boost, you will have success in the request. </p> <p> Regards, Vladimir </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Wed, 26 May 2010 09:49:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3931#comment:5 https://svn.boost.org/trac10/ticket/3931#comment:5 <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">wontfix</span> </li> </ul> <p> I am not planning to do anything further. It's compiler problem. </p> Ticket James Hugard <james_hugard@…> Wed, 22 May 2013 21:45:20 GMT <link>https://svn.boost.org/trac10/ticket/3931#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3931#comment:6</guid> <description> <p> Appears to be a duplicate of Ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5048" title="#5048: Bugs: compilation error under ia64 HP-UX11i with gcc-4.4.0 (closed: fixed)">#5048</a>. </p> </description> <category>Ticket</category> </item> </channel> </rss>