Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function name and macro was conflict #19

Open
Hojun-Cho opened this issue May 13, 2023 · 4 comments
Open

function name and macro was conflict #19

Hojun-Cho opened this issue May 13, 2023 · 4 comments

Comments

@Hojun-Cho
Copy link
Contributor

  • error
#define csp_without_prefix

#include <libcsp/csp.h>
#include <unistd.h>
In file included from /usr/local/include/libcsp/csp.h:28,
                 from sum.c:18:
/usr/include/unistd.h:1005:13: error: expected identifier or ‘(’ before ‘do’
 1005 | extern void sync (void) __THROW;
      |             ^~~~
/usr/include/unistd.h:1005:13: error: expected identifier or ‘(’ before ‘while’
 1005 | extern void sync (void) __THROW;
  • But if you reverse the order, it works.
#define csp_without_prefix

#include <unistd.h>
#include <libcsp/csp.h>

How can solve this problem? Am i use "csp_async" and "csp_sync" not "sync" and "async".

Thankyou for reading this issue

@shiyanhui
Copy link
Owner

Please make sure that it meets

  • GCC >= 8.0
  • Architecture = Linux x86_64

@Hojun-Cho
Copy link
Contributor Author

Here's my environment

  • GCC : 13.1.1
  • Architecture: Linux arch 6.3.8-arch1-1 x86_64

@shiyanhui
Copy link
Owner

I have tested it with GCC 8/9/10, not sure whether it's caused by the gcc version. You can try it with gcc8 to test it.

@Hojun-Cho
Copy link
Contributor Author

I think you need to consider the order of "include".
Not like this

#include <libcsp/csp.h>
#include <unistd.h>

like this

#include <unistd.h>
#include <libcsp/csp.h>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants