[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] compile issue: header not necessarily included for atomic
From: |
Gergely Imreh |
Subject: |
Re: [gpsd-dev] compile issue: header not necessarily included for atomic_thread_fence |
Date: |
Thu, 26 Nov 2015 12:17:31 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
Hi Gary,
On 11/26/2015 03:18 AM, Gary E. Miller wrote:
> Yo Gergely!
>
> On Wed, 25 Nov 2015 11:15:53 +0800 Gergely Imreh <address@hidden>
> wrote:
>
>> I've been trying to build the latest version from git, and run
>> into this issue:
>
> First thing is we need to know you OS, distro, CC version, etc.
ArchLinux, GCC 5.2.0, scons v2.4.0.rel_2.4.0:3365:9259ea1c13d7.
Any other info is needed?
>
>> 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.
>
> Possibly, but I'd like to know what the __cplusplus is from. I
> have no idea what OS, dirstro, CC would set that and that is way
> too generic a test for my taste.
Looking it up, __cplusplus is a standard macro in GCC and "defined
when the C++ compiler is in use."
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
The reason I have that check in the patch, because there's already the
exact same check earlier in compilers.h (lines 68-72):
#ifdef HAVE_STDATOMIC_H
#if !defined(__COVERITY__) && !defined(__cplusplus)
#include <stdatomic.h>
#endif /* __COVERITY__ || __cplusplus */
#endif /* HAVE_STDATOMIC_H */
Because of this, it's possible that the checks evaluate differently,
and atomic_thread_fence is called without the header being included.
Hence the patch.
That __cplusplus check for the #include was added in commit
79f6d9133378325d70a92e66f7352c1becefbb88 and there's no rationale
given in the commit message why it is needed (just a sign-off by you).
If there's a better solution, I'm happy to hear.
Cheers,
Gergely
signature.asc
Description: OpenPGP digital signature