Bug #906

The _Atomic_word and __exchange_and_add issue on FreeBSD LLVM/Clang compiler

Added by Sender Ghost over 9 years ago. Updated over 9 years ago.

Status:ApprovedStart date:10/15/2014
Priority:NormalDue date:
Assignee:Miroslav Fidler% Done:

0%

Category:CoreSpent time:-
Target version:-

Description

The FreeBSD LLVM/Clang compiler (for example, 3.3 version on FreeBSD 10) complains about undefined _Atomic_word type and __exchange_and_add function inside of uppsrc/Core/Mt.h file. Also, there is no bits/atomic.h or ext/atomic.h files inside of include directories to resolve this.

I propose to use __sync_fetch_and_add function instead of __exchange_and_add and int type instead of _Atomic_word in case of using FreeBSD LLVM/Clang compiler. I generalised this to PLATFORM_BSD and __clang__ defines, but it could be related to other platforms without mentioned type and function.

uppsrc_Core_Mt.h.diff Magnifier - The diff file to apply for uppsrc directory (830 Bytes) Sender Ghost, 10/15/2014 10:46 AM

History

#1 Updated by Sender Ghost over 9 years ago

  • File deleted (patch-uppsrc_Core_Mt.h)

#3 Updated by Sender Ghost over 9 years ago

The mentioned error message, when building TheIDE on GUI MT package configuraion:

In file included from ide/UppWspc.cpp:1:
In file included from ide/ide.h:4:
In file included from ./ide/Common/Common.h:4:
In file included from ./ide/Core/Core.h:4:
In file included from ./Esc/Esc.h:4:
In file included from ./Core/Core.h:272:
./Core/Mt.h:281:9: error: unknown type name '_Atomic_word'
typedef _Atomic_word Atomic;
        ^
./Core/Mt.h:283:73: error: expected namespace name
inline int  AtomicXAdd(volatile Atomic& t, int incr)  { using namespace __gnu_cxx; return __exchange_and_add(&t...
                                                                        ^
./Core/Mt.h:283:91: error: use of undeclared identifier '__exchange_and_add'
inline int  AtomicXAdd(volatile Atomic& t, int incr)  { using namespace __gnu_cxx; return __exchange_and_add(&t...

#4 Updated by Miroslav Fidler over 9 years ago

Thanks, applied.

#5 Updated by Miroslav Fidler over 9 years ago

  • Status changed from Patch ready to Approved

Also available in: Atom PDF