Sorry, my email setup is probably force wrapping everything. Long
lines might cause trouble. I unchecked every wrap option from my end.
It might be the email service provider, not sure.

> That is wrong. Make it:
> 
>     const int result = pthread_setname_np(pthread_self(), "%s", name_.c_str())

I don't know if I'm doing something wrong.
It shows error if I make this change:


$ conan build . -s build_type=Release -s compiler.cppstd=17 --build=missing -o 
"&:update_checks=False"
...
...
[ 51%] Building CXX object 
src/cpp-utils/CMakeFiles/cpp-utils.dir/thread/debugging_nonwindows.cpp.o
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:
 In function ���void cpputils::set_thread_name(const char*)���:
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:32:74:
 error: invalid conversion from ���const void*��� to ���void*��� [-fpermissive]
   32 |   const int result = pthread_setname_np(pthread_self(), "%s", 
name_.c_str());
      |                                                               
~~~~~~~~~~~^~
      |                                                                         
 |
      |                                                                         
 const void*
In file included from /usr/include/g++/bits/gthr-posix.h:35,
                 from /usr/include/g++/bits/gthr.h:148,
                 from /usr/include/g++/ext/atomicity.h:35,
                 from /usr/include/g++/bits/basic_string.h:39,
                 from /usr/include/g++/string:55,
                 from 
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging.h:5,
                 from 
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:3:
/usr/include/pthread.h:160:49: note:   initializing argument 3 of ���int 
pthread_setname_np(pthread_t, const char*, void*)���
  160 | int pthread_setname_np(pthread_t, const char *, void *);
      |                                                 ^~~~~~
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:
 In destructor ���cpputils::{anonymous}::OpenFileRAII::~OpenFileRAII()���:
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:50:13:
 warning: ���throw��� will always call ���terminate��� [-Wterminate]
   50 |             throw std::runtime_error("Error closing file. Errno: " + 
std::to_string(errno));
      |             
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:50:13:
 note: in C++11 destructors default to ���noexcept���
gmake[2]: *** [src/cpp-utils/CMakeFiles/cpp-utils.dir/build.make:429: 
src/cpp-utils/CMakeFiles/cpp-utils.dir/thread/debugging_nonwindows.cpp.o] Error 
1
gmake[1]: *** [CMakeFiles/Makefile2:593: 
src/cpp-utils/CMakeFiles/cpp-utils.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

ERROR: conanfile.py (cryfs/na): Error in build() method, line 169
        cmake.build()
        ConanException: Error 2 while executing


Here is a diff in case I messed up:


diff --git a/src/cpp-utils/thread/debugging_nonwindows.cpp 
b/src/cpp-utils/thread/debugging_nonwindows.cpp
index 155e380..a227eab 100644
--- a/src/cpp-utils/thread/debugging_nonwindows.cpp
+++ b/src/cpp-utils/thread/debugging_nonwindows.cpp
@@ -29,7 +29,7 @@ void set_thread_name(const char* name) {
   const int result = pthread_setname_np(name_.c_str());
 #else
 #  if defined(__NetBSD__)
-  const int result = pthread_setname_np(pthread_self(), name_.c_str(), 
(void*)strlen(name_.c_str()));
+  const int result = pthread_setname_np(pthread_self(), "%s", name_.c_str());
 #  else
   const int result = pthread_setname_np(pthread_self(), name_.c_str());
 #  endif

Reply via email to