apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

example/rdma_performance compile error in gcc 11: error: macro "__has_attribute" requires an identifier #2740

Closed ivanallen closed 3 months ago

ivanallen commented 3 months ago

Describe the bug (描述bug)

g++ -c -I/usr/include/ -I../../output/include -std=c++0x -DBRPC_WITH_GLOG=0 -DGFLAGS_NS=google -D__const__=__unused__ -g -DBRPC_WITH_RDMA -std=c++0x -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer test.pb.cc -o test.pb.o
<command-line>: warning: "__const__" redefined
<command-line>: note: this is the location of the previous definition
In file included from /usr/include/features.h:486,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
                 from /usr/include/c++/11/limits:42,
                 from test.pb.h:7,
                 from test.pb.cc:4:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:314:60: error: macro "__has_attribute" requires an identifier
  314 | #if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__)
      |                                                            ^
make: *** [Makefile:98: test.pb.o] Error 1
rm test.pb.cc

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本) OS: Compiler: brpc: protobuf:

Additional context/screenshots (更多上下文/截图)

chenBright commented 3 months ago

相关issue:#1693