[cfe-dev] clang doesn't compile simple code

fprijate prijatelj.francek at gmail.com
Mon Apr 21 22:23:51 PDT 2014


Hi

Here is sample output from compiling libpng which is part of our platform.

clang   -I. -I../../../../../../include -Wmissing-braces -Wreturn-type
-Wformat -Wimplicit-int
 -Wimplicit-function-declaration -O3  -DUNICODE
-IG:/HRB_SVN/SRC-GIT/src/3rd/zlib -DPNG_NO_STDIO
 -IC:/msys32/mingw32/lib/clang/3.5.0/include -fms-extensions   -opng.o  -c
../../../png.c
 
In file included from ../../../png.c:14:
In file included from ../../../pngpriv.h:462:
In file included from
C:/msys32/mingw32/bin/../i686-w64-mingw32/include\windows.h:69:
In file included from
C:/msys32/mingw32/bin/../i686-w64-mingw32/include\windef.h:8:
In file included from
C:/msys32/mingw32/bin/../i686-w64-mingw32/include\minwindef.h:146:
In file included from
C:/msys32/mingw32/bin/../i686-w64-mingw32/include\winnt.h:26:
C:/msys32/mingw32/bin/../i686-w64-mingw32/include\psdk_inc/intrin-impl.h:960:10:
error: definition of builtin function
 '_InterlockedExchangeAdd'
__LONG32 _InterlockedExchangeAdd(__LONG32 volatile *Addend, __LONG32 Value)
{


As you see intrin-impl.h is included from winnt.h 

#define __INTRINSIC_GROUP_WINNT /* only define the intrinsics in this file
*/
#include <psdk_inc/intrin-impl.h>

I also did a little hack changing psdk/intrin-impl to intrin.h in winnt.h
and here is result:


clang   -I. -I../../../../../../include -Wmissing-braces -Wreturn-type
-Wformat -Wimplicit-int -Wimplicit-function-declaration -O3  -DUNICODE
-IG:/HRB_SVN/SRC-GIT/src/3rd/zlib -DPNG_NO_STDIO
-IC:/msys32/mingw32/lib/clang/3.5.0/include -fms-extensions   -opng.o  -c
../../../png.c
In file included from ../../../png.c:14:
In file included from ../../../pngpriv.h:462:
In file included from
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\windows.h:69:
In file included from
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\windef.h:8:
In file included from
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\minwindef.h:146:
In file included from
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\winnt.h:27:
C:/msys32/mingw32/lib/clang/3.5.0/include/intrin.h:294:13: error:
conflicting types for '_setjmp'
int __cdecl _setjmp(jmp_buf);
            ^
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\setjmp.h:164:63: note:
previous declaration is here
  int __cdecl __attribute__ ((__nothrow__,__returns_twice__))
_setjmp(jmp_buf _Buf, void *_Ctx);

            ^
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\setjmp.h:164:63: note:
previous declaration is here
  int __cdecl __attribute__ ((__nothrow__,__returns_twice__))
_setjmp(jmp_buf _Buf, void *_Ctx);
                                                              ^
In file included from ../../../png.c:14:
In file included from ../../../pngpriv.h:462:
In file included from
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\windows.h:70:
In file included from
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\winbase.h:45:
C:\msys32\mingw32\bin/../i686-w64-mingw32/include\psdk_inc/intrin-impl.h:849:13:
error: redefinition of '__stosb'
__buildstos(__stosb, unsigned char, "b")
....

IMHO the simplest solution would be if clang/gcc preprocessor translates
_cdecl,_stdcall,... to
__attribute__((...)) .

 
regards
FranĨek



--
View this message in context: http://clang-developers.42468.n3.nabble.com/clang-doesn-t-compile-simple-code-tp4038903p4038944.html
Sent from the Clang Developers mailing list archive at Nabble.com.




More information about the cfe-dev mailing list