Fix gcc build error.
Fixes: 7e68af7ce2c1 ("fusefs: redo vnode attribute locking")
Differential D56370
tests/fusefs: appease gcc -Wcast-qual Authored by rlibby on Mon, Apr 13, 2:02 AM. Tags None Referenced Files
Details
Fix gcc build error. Fixes: 7e68af7ce2c1 ("fusefs: redo vnode attribute locking")
Diff Detail
Event TimelineComment Actions Instead of relying on casting, how about we fix the problem more robustly, like this? diff --git a/tests/sys/fs/fusefs/rename.cc b/tests/sys/fs/fusefs/rename.cc index 385f26953aae..ae57469f2665 100644 --- a/tests/sys/fs/fusefs/rename.cc +++ b/tests/sys/fs/fusefs/rename.cc @@ -166,7 +166,7 @@ TEST_F(Rename, entry_cache_negative_purge) static volatile int stopit = 0; static void* setattr_th(void* arg) { - char *path = (char*)arg; + const char *path = *(const char**)arg; while (stopit == 0) chmod(path, 0777); @@ -239,7 +239,7 @@ TEST_F(Rename, erelookup) _) ).WillRepeatedly(Invoke(ReturnErrno(EIO))); - ASSERT_EQ(0, pthread_create(&th0, NULL, setattr_th, (void*)FULLSRC)) + ASSERT_EQ(0, pthread_create(&th0, NULL, setattr_th, (void*)&FULLSRC)) << strerror(errno); ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &timeout)); Comment Actions This leads to essentially the same complaint from gcc: /usr/src/freebsd/tests/sys/fs/fusefs/rename.cc:242:61: error: cast from type 'const char (*)[15]' to type 'void*' casts away qualifiers [-Werror=cast-qual]
242 | ASSERT_EQ(0, pthread_create(&th0, NULL, setattr_th, (void*)&FULLSRC))
| ^~~~~~~~~~~~~~~ |