Skip to content

Error in stdatomic_helper.h while compiling with gcc version > 5 #13

Closed

Description

@firesurfer

I get the following error while compiling ROS2 with gcc (Debian 5.3.1-4) 5.3.1 20151219

error: missing binary operator before token "("
 #elif defined(__clang__) && defined(__has_feature) && !__has_feature(c_atomic)

It compiles when I change line 23 in stdatomic_helper.h from

#elif defined(__clang__) && defined(__has_feature) && !__has_feature(c_atomic)

to

#elif defined(__clang__) && defined(__has_feature) 

on my server with gcc (Debian 4.9.2-10) 4.9.2 it compiles without any errors.

Activity

  1. wjwwood commented on Jan 5, 2016

    @wjwwood
    Member

    Interesting, thanks. I guess the evaluation of the conditional doesn't stop when defined(__has_feature) is false.

    I suppose we can try something like this:

    #elif defined(__clang__) && defined(__has_feature)
    #if !__has_feature(c_atomic)
    ...
    #endif
    ...
  2. wjwwood commented on Jan 5, 2016

    @wjwwood
    Member

    @firesurfer if you have a chance, can you try the above and let me know if it works? I don't have a GCC 5 machine handy. If not I can set one up later.

  3. added
    bug
    on Jan 5, 2016
  4. self-assigned this
    on Jan 5, 2016
  5. firesurfer commented on Jan 5, 2016

    @firesurfer
    ContributorAuthor

    Hey,
    if I change it to:

    #elif defined(__clang__) && defined(__has_feature) 
    #if !__has_feature(c_atomic)
    // If Clang and no c_atomics (true for some older versions), use the compatability header.
    #include "stdatomic_helper/gcc/stdatomic.h"
    #endif

    it compiles.

  6. added a commit that references this issue on Jan 5, 2016
    ec0e930
  7. added
    in progress
    on Jan 5, 2016
  8. wjwwood commented on Jan 5, 2016

    @wjwwood
    Member

    I proposed this as a fix: #14

  9. removed
    in progress
    on Jan 5, 2016
  10. added a commit that references this issue on Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions