[cfe-dev] How to disable built-in?

David Chisnall csdavec at swan.ac.uk
Tue Apr 24 04:48:15 PDT 2012


This builtin is also present in GCC 4.7.  I suspect that the code brackets it in a version check that tests for a GCC version >= 4.7.  Since clang reports the GCC version 4.2, this will fail.  

The correct fix is to wrap the check in !__has_builtin(__atomic_compare_exchange), rather than a specific compiler version.  A more hacky work-around would be to #undef the GCC version macros before including this header and re#define them as gcc 4.7.  

David

On 24 Apr 2012, at 10:21, Dmitri Shubin wrote:

> Hello!
> 
> When building Berkeley DB (checked 4.8.30 and 5.1.25) with clang (trunk) 
> I got the following error:
> 
> In file included from 
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/mutex/mut_pthread.c:11:
> In file included from ./db_int.h:999:
> In file included from 
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/mutex.h:15:
> In file included from 
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/mutex_int.h:12:
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/atomic.h:179:19: 
> error: definition of builtin function '__atomic_compare_exchange'
> static inline int __atomic_compare_exchange(
>                   ^
> 1 error generated.
> 
> AFAIU this built-in was added rather recently since I was able to build 
> it with clang a month or so ago.
> 
> Is there any way to disable this built-in?
> '-fno-builtin' doesn't help.
> 
> (Yes, I know that it's bad idea to start identifiers with underscores)
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list