@@ -634,6 +634,9 @@ namespace loguru
634634 pthread_set_name_np (this_thread, main_thread_name);
635635 #elif defined(__linux__) || defined(__sun)
636636 pthread_setname_np (this_thread, main_thread_name);
637+ #else
638+ // platforms that we don't know how to set the name on
639+ (void )this_thread; // unused
637640 #endif
638641 }
639642 #endif // LOGURU_PTHREADS
@@ -1049,6 +1052,9 @@ namespace loguru
10491052 pthread_set_name_np (pthread_self (), name);
10501053 #elif defined(__linux__) || defined(__sun)
10511054 pthread_setname_np (pthread_self (), name);
1055+ #else
1056+ // Platforms that may not support setting a thread name
1057+ (void )name; // unused
10521058 #endif
10531059 #elif LOGURU_WINTHREADS
10541060 // Store thread name in a thread-local storage:
@@ -1076,7 +1082,13 @@ namespace loguru
10761082 // Ask the OS about the thread name.
10771083 // This is what we *want* to do on all platforms, but
10781084 // only some platforms support it (currently).
1079- pthread_getname_np (pthread_self (), buffer, length);
1085+
1086+ #ifdef __APPLE__ || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(__sun)
1087+ pthread_getname_np (pthread_self (), buffer, length);
1088+ #else
1089+ // Other platforms that don't support thread names
1090+ buffer[0 ] = 0 ;
1091+ #endif
10801092 #elif LOGURU_WINTHREADS
10811093 snprintf (buffer, static_cast <size_t >(length), " %s" , thread_name_buffer ());
10821094 #else
0 commit comments