Boost C++ Libraries: Ticket #11110: ES identifier causes compilation failure in polygon/transform.hpp becase of Solaris bug https://svn.boost.org/trac10/ticket/11110 <ol><li>Description of the failure. </li></ol><p> Several tests inside libs/geometry/test directory fail with Oracle Studio 12.4 C++ compiler on Solaris producing error message similar to this: </p> <p> CC -c -library=stlport4 -erroff=%none -KPIC -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I. -I../../.. -I../../../boost/geometry/extensions/contrib/ttmath geometries/boost_polygon.cpp </p> <p> "../../../boost/polygon/transform.hpp", line 49: Error: Identifier expected instead of "2". </p> <ol start="2"><li>Cause of the failure. </li></ol><p> transform.hpp header is perfectly fine from user standpoint, and the failure is related to long-existing bug in all later Solaris versions. Basically, compilation of any C or C++ code will fail on Solaris if it will satisfy two conditions: </p> <ul><li>The presense of #include &lt;sys/regset.h&gt; system header, direct or indirectly attached through other system headers from /usr/include directory. </li></ul><ul><li>The presence of identifires which accidentally coincide with X86 register names, like CS, DS, ES, ... </li></ul><p> Here is an example of such 2 lines code: </p> <p> #include &lt;sys/regset.h&gt; </p> <p> void foo() { enum E { ES=2 }; } </p> <p> its compilation will produce error message similar to the one shown above. The failure occur because that sys/regset.h has the following macros: </p> <p> #define CS 15 </p> <p> #define DS 3 </p> <p> #define ES 2 </p> <p> and when compiler preprocesses sys/regset.h after that it automatically replaces user identifiers which accidentally have the same names with those numbers shown above. </p> <p> So, in the original libs/geometry/test/geometries/boost_polygon.cpp test &lt;sys/regset.h&gt; has been attached indirectly through long chain of system headers defined inside STL library with the usage of -library=stlport4 option. So, when finally compiler preprocesses code from boost/polygon/transform.hpp shown below: </p> <blockquote> <p> enum ATR { </p> </blockquote> <blockquote> <blockquote> <p> ES = 2, EAST_SOUTH = 2, FLIP_Y = 2, <em> Line 49 </em></p> </blockquote> </blockquote> <p> it wrongly replaces ES with '2' assuming that it comes from macro defined inside sys/regset.h </p> <ol start="3"><li>Possible Solution. </li></ol><p> To replace ES identifier inside boost/polygon/transform.hpp with any other similar name, like for example E_S. And if it's not acceptable for every compiler, then please do it just for Oracle studio compiler like this: </p> <p> #if definde <span class="underline">SUNPRO_CC </span></p> <blockquote> <p> E_S = 2, EAST_SOUTH = 2, FLIP_Y = 2, </p> </blockquote> <p> #else </p> <blockquote> <p> ES = 2, EAST_SOUTH = 2, FLIP_Y = 2, </p> </blockquote> <p> #endif </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11110 Trac 1.4.3 Andrii Sydorchuk Fri, 20 Mar 2015 20:47:33 GMT owner, milestone changed https://svn.boost.org/trac10/ticket/11110#comment:1 https://svn.boost.org/trac10/ticket/11110#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Lucanus Simonson</span> to <span class="trac-author">Andrii Sydorchuk</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> Ticket Andrii Sydorchuk Fri, 20 Mar 2015 20:52:43 GMT <link>https://svn.boost.org/trac10/ticket/11110#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11110#comment:2</guid> <description> <p> Hi Sergey, </p> <p> Thank you for a detailed report! It was decided to fix the issue by hiding two-letters ATR enum names under BOOST_POLYGON_ENABLE_DEPRECATED directive. The fix is already in develop branch and will be merged into master branch of 1.58 release. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrii Sydorchuk</dc:creator> <pubDate>Fri, 20 Mar 2015 21:56:25 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11110#comment:3 https://svn.boost.org/trac10/ticket/11110#comment:3 <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> The fix was pushed to the master branch. </p> Ticket