<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - Clang has missing/different macros than gcc - causing compatibility issues" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23729&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gBaikCBFWUQVUiR87y5Vv9Yrk_Or7rhcuIgkoGo53i4&s=phG_tO1EwiGJImMTj-naPR8UxDyQHovXsCmVOdKXWwU&e=">23729</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang has missing/different macros than gcc - causing compatibility issues
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>npl@chello.at
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14419" name="attach_14419" title="gcc defines">attachment 14419</a> <a href="attachment.cgi?id=14419&action=edit" title="gcc defines">[details]</a></span>
gcc defines

Hello,

I tried compiling out project at work, which is a realtime firmware for arm.
Ideally clang would be just able to generate correct code, but it misbehaves on
a few accounts. I consider some of these macros pretty much defacto-standard,
as eg. newlib is using and depending on these.

__SOFTFP__ is not set, implicating hardware floating point support
__USES_INITFINI__ is not set, resulting in initialisation functions not being
called

And several macros are quite different:
__ARM_SIZEOF_WCHAR_T  32  vs.  4
__FLT_* sizes are different, probably just nonrelevant extra precision
__INTPTR_TYPE__,__UINT32_TYPE__,__WINT_TYPE__ etc.   int vs. long int (kills
binary compatibility)

I used these 2 commands (clang needed the system directories defined, din`t
pick them up correctly)
LC_ALL=C /opt/toolchain/bin/arm-none-eabi-g++ -fmessage-length=0 -DNVALGRIND
-Wignored-qualifiers -mcpu=arm926ej-s -fstrict-aliasing -ftls-model=local-exec
-fno-threadsafe-statics -ffunction-sections -fdata-sections
-mpoke-function-name -DPOKE_FUNCTION_NAME -Wpointer-arith -Wno-psabi
-Wsign-compare -fstrict-overflow -Wnoexcept -std=gnu++11 -Wall -O2 -g2  \
           \
            -E -P -dD -x c++ -v - < /dev/null 2>&1


LC_ALL=C /opt/toolchain/bin/arm-none-eabi-clang++ -fmessage-length=0
-DNVALGRIND -Wignored-qualifiers -mcpu=arm926ej-s -fstrict-aliasing
-ftls-model=local-exec -fno-threadsafe-statics -ffunction-sections
-fdata-sections -fshort-enums -fshort-enums -Wpointer-arith -Wsign-compare
-Wimplicit-fallthrough -std=gnu++11 -Wall -O2 -g3  \
           \
        -nostdinc
-I/opt/toolchain-4.8/lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/include/c++/4.8.4
-I/opt/toolchain-4.8/lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/include/c++/4.8.4/arm-none-eabi/armv5te
-I/opt/toolchain-4.8/lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/include/c++/4.8.4/backward
-I/opt/toolchain-4.8/lib/gcc/arm-none-eabi/4.8.4/include
-I/opt/toolchain-4.8/lib/gcc/arm-none-eabi/4.8.4/include-fixed
-I/opt/toolchain-4.8/lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/include 
        \ 
        -E -P -dD -x c++ -v - < /dev/null 2>&1</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>