Skip to content

clang-tidy error (on not-linux): use nullptr instead of NULL #261

@pinheadmz

Description

@pinheadmz

Running clang-tidy on macos I get this error:

/Users/matthewzipkin/Desktop/work/bitcoin/src/ipc/libmultiprocess/src/mp/util.cpp:84:25: error: use nullptr [modernize-use-nullptr,-warnings-as-errors]
   84 |     pthread_threadid_np(NULL, &tid);
      |                         ^~~~
      |                         nullptr

I suspect the reason this hasn't triggered failures on our CI is that this code block is not compiled on linux:

#ifdef __linux__
buffer << syscall(SYS_gettid);
#elif defined(HAVE_PTHREAD_THREADID_NP)
uint64_t tid = 0;
pthread_threadid_np(NULL, &tid);
buffer << tid;
#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
buffer << pthread_getthreadid_np();
#else
buffer << std::this_thread::get_id();
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions