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.57k stars 3.98k forks source link

error: cannot initialize return object of type 'uint64_t' (aka 'unsigned long') with an rvalue of type 'pthread_t' #2071

Open yurivict opened 1 year ago

yurivict commented 1 year ago

Describe the bug (描述bug)

/usr/ports/devel/brpc/work/incubator-brpc-1.3.0/src/butil/compat.h:85:12: error: cannot initialize return object of type 'uint64_t' (aka 'unsigned long') with an rvalue of type 'pthread_t' (aka 'pthread *')
    return pthread_self();
           ^~~~~~~~~~~~~~
2 errors generated.
``

**To Reproduce (复现方法)**
build on FreeBSD

According to the documentation pthread_self returns pthread_t:

NAME pthread_self – get the calling thread's ID

LIBRARY POSIX Threads Library (libpthread, -lpthread)

SYNOPSIS

include

 pthread_t
 pthread_self(void);

pthread_t generally can not and should not be typecast to any other type.

**Versions (各种版本)**
OS: FreeBSD 13.1
Compiler: clang-14
brpc: 1.3.0
wwbmmm commented 1 year ago

related: #2072