gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] compile issue: header not necessarily included for atomic_thr


From: Gergely Imreh
Subject: [gpsd-dev] compile issue: header not necessarily included for atomic_thread_fence
Date: Wed, 25 Nov 2015 11:15:53 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Hi,

I've been trying to build the latest version from git, and run into
this issue:

In file included from clock_gettime.c:10:0:
compiler.h: In function 'void memory_barrier()':
compiler.h:83:25: error: 'memory_order_seq_cst' was not declared in
this scope
     atomic_thread_fence(memory_order_seq_cst);
                         ^
compiler.h:83:45: error: 'atomic_thread_fence' was not declared in
this scope
     atomic_thread_fence(memory_order_seq_cst);
                                             ^
scons: *** [qt-clock_gettime.os] Error 1
scons: building terminated because of errors.

(using "scons prefix=/usr systemd=yes libQgpsmm=no gpsd_group=uucp
PYTHONPATH=/usr/bin/python2 sbindir=/usr/bin")

Looking at compiler.h, the issue was probably introduced by commit
79f6d9133378325d70a92e66f7352c1becefbb88 because the relevant #include
was added with a different #ifdef logic than the actual function call:
the header checks for HAVE_STDATOMIC_H, !COVERITY and !cplusplus,
while the function call inclusion just checks for the first two.

I think one solution is the patch below to make the selection logic
the same for the function call as for the #include. It does compile,
but would appreciate a look whether it has any other issues.

Cheers,
   Gergely


diff --git a/compiler.h b/compiler.h
index 2f2a8ed..19a4566 100644
--- a/compiler.h
+++ b/compiler.h
@@ -79,7 +79,7 @@ static inline void memory_barrier(void)
 /* prevent instruction reordering across any call to this function */
 {
 #ifdef HAVE_STDATOMIC_H
-#ifndef __COVERITY__
+#if !defined(__COVERITY__) && !defined(__cplusplus)
     atomic_thread_fence(memory_order_seq_cst);
 #endif /* __COVERITY__ */
 #elif defined(HAVE_OSATOMIC_H)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]