Skip to content

Commit 45a2f2d

Browse files
author
lovro
committed
Fix build without glibc
Summary: The preprocessor does not follow normal rules of && evaluation, tries to evaluate __GLIBC_PREREQ(2, 12) even though the defined() check fails. This breaks the build if __GLIBC_PREREQ is absent. Test Plan: Try adding #undef __GLIBC_PREREQ above the offending line, build no longer breaks Reviewed By: igor Blame Rev: 4c81383
1 parent 38feca4 commit 45a2f2d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

util/env_posix.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1398,11 +1398,13 @@ class PosixEnv : public Env {
13981398
(unsigned long)t);
13991399

14001400
// Set the thread name to aid debugging
1401-
#if defined(_GNU_SOURCE) && defined(__GLIBC_PREREQ) && (__GLIBC_PREREQ(2, 12))
1401+
#if defined(_GNU_SOURCE) && defined(__GLIBC_PREREQ)
1402+
#if __GLIBC_PREREQ(2, 12)
14021403
char name_buf[16];
14031404
snprintf(name_buf, sizeof name_buf, "rocksdb:bg%zu", bgthreads_.size());
14041405
name_buf[sizeof name_buf - 1] = '\0';
14051406
pthread_setname_np(t, name_buf);
1407+
#endif
14061408
#endif
14071409

14081410
bgthreads_.push_back(t);

0 commit comments

Comments
 (0)