qemu/atomic.h: add #ifdef guards for stdatomic.h
Deep inside the FreeBSD netmap headers we end up including stdatomic.h which clashes with qemu's atomic functions which are modelled along the C11 standard. To avoid a massive rename lets just ifdef around the problem. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200326170121.13045-1-alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
		
							parent
							
								
									cfe68ae025
								
							
						
					
					
						commit
						f4ce3adf6b
					
				@ -208,11 +208,14 @@
 | 
				
			|||||||
/* Provide shorter names for GCC atomic builtins, return old value */
 | 
					/* Provide shorter names for GCC atomic builtins, return old value */
 | 
				
			||||||
#define atomic_fetch_inc(ptr)  __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_inc(ptr)  __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
 | 
				
			||||||
#define atomic_fetch_dec(ptr)  __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_dec(ptr)  __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef atomic_fetch_add
 | 
				
			||||||
#define atomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST)
 | 
				
			||||||
#define atomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST)
 | 
				
			||||||
#define atomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)
 | 
				
			||||||
#define atomic_fetch_or(ptr, n)  __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_or(ptr, n)  __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)
 | 
				
			||||||
#define atomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST)
 | 
					#define atomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define atomic_inc_fetch(ptr)    __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
 | 
					#define atomic_inc_fetch(ptr)    __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
 | 
				
			||||||
#define atomic_dec_fetch(ptr)    __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
 | 
					#define atomic_dec_fetch(ptr)    __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
 | 
				
			||||||
@ -392,11 +395,14 @@
 | 
				
			|||||||
/* Provide shorter names for GCC atomic builtins.  */
 | 
					/* Provide shorter names for GCC atomic builtins.  */
 | 
				
			||||||
#define atomic_fetch_inc(ptr)  __sync_fetch_and_add(ptr, 1)
 | 
					#define atomic_fetch_inc(ptr)  __sync_fetch_and_add(ptr, 1)
 | 
				
			||||||
#define atomic_fetch_dec(ptr)  __sync_fetch_and_add(ptr, -1)
 | 
					#define atomic_fetch_dec(ptr)  __sync_fetch_and_add(ptr, -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef atomic_fetch_add
 | 
				
			||||||
#define atomic_fetch_add(ptr, n) __sync_fetch_and_add(ptr, n)
 | 
					#define atomic_fetch_add(ptr, n) __sync_fetch_and_add(ptr, n)
 | 
				
			||||||
#define atomic_fetch_sub(ptr, n) __sync_fetch_and_sub(ptr, n)
 | 
					#define atomic_fetch_sub(ptr, n) __sync_fetch_and_sub(ptr, n)
 | 
				
			||||||
#define atomic_fetch_and(ptr, n) __sync_fetch_and_and(ptr, n)
 | 
					#define atomic_fetch_and(ptr, n) __sync_fetch_and_and(ptr, n)
 | 
				
			||||||
#define atomic_fetch_or(ptr, n) __sync_fetch_and_or(ptr, n)
 | 
					#define atomic_fetch_or(ptr, n) __sync_fetch_and_or(ptr, n)
 | 
				
			||||||
#define atomic_fetch_xor(ptr, n) __sync_fetch_and_xor(ptr, n)
 | 
					#define atomic_fetch_xor(ptr, n) __sync_fetch_and_xor(ptr, n)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define atomic_inc_fetch(ptr)  __sync_add_and_fetch(ptr, 1)
 | 
					#define atomic_inc_fetch(ptr)  __sync_add_and_fetch(ptr, 1)
 | 
				
			||||||
#define atomic_dec_fetch(ptr)  __sync_add_and_fetch(ptr, -1)
 | 
					#define atomic_dec_fetch(ptr)  __sync_add_and_fetch(ptr, -1)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user