rocksdb/env
Yanqin Jin cb1bf09bfc Fix tsan error (#5414)
Summary:
Previous code has a warning when compile with tsan, leading to an error since we have -Werror.
Compilation result
```
In file included from ./env/env_chroot.h:12,
                 from env/env_test.cc:40:
./include/rocksdb/env.h: In instantiation of ‘rocksdb::Status rocksdb::DynamicLibrary::LoadFunction(const string&, std::function<T>*) [with T = void*(void*, const char*); std::__cxx11::string = std::__cxx11::basic_string<char>]’:
env/env_test.cc:260:5:   required from here
./include/rocksdb/env.h:1010:17: error: cast between incompatible function types from ‘rocksdb::DynamicLibrary::FunctionPtr’ {aka ‘void* (*)()’} to ‘void* (*)(void*, const char*)’ [-Werror=cast-function-type]
     *function = reinterpret_cast<T*>(ptr);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [env/env_test.o] Error 1
```
It also has another error reported by clang
```
env/env_posix.cc:141:11: warning: Value stored to 'err' during its initialization is never read
    char* err = dlerror();  // Clear any old error
          ^~~   ~~~~~~~~~
1 warning generated.
```

Test plan (on my devserver).
```
$make clean
$OPT=-g ROCKSDB_FBCODE_BUILD_WITH_PLATFORM007=1 COMPILE_WITH_TSAN=1 make -j32
$
$make clean
$USE_CLANG=1 TEST_TMPDIR=/dev/shm/rocksdb OPT=-g make -j1 analyze
```
Both should pass.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5414

Differential Revision: D15637315

Pulled By: riversand963

fbshipit-source-id: 8e307483761019a4d5998cab92d49516d7edffbf
2019-06-05 15:42:23 -07:00
..
env.cc Move some memory related files from util/ to memory/ (#5382) 2019-05-30 17:44:09 -07:00
env_basic_test.cc Move test related files under util/ to test_util/ (#5377) 2019-05-30 11:25:51 -07:00
env_chroot.cc Apply modernize-use-override (3) 2019-02-19 13:39:49 -08:00
env_chroot.h Change RocksDB License 2017-07-15 16:11:23 -07:00
env_encryption.cc Change OptimizeForPointLookup() and OptimizeForSmallDb() (#5165) 2019-04-11 10:45:36 -07:00
env_hdfs.cc Move some logging related files to logging/ (#5387) 2019-05-31 17:23:59 -07:00
env_posix.cc Fix tsan error (#5414) 2019-06-05 15:42:23 -07:00
env_test.cc Add a MultiRead() method to Env (#5311) 2019-06-05 09:41:34 -07:00
io_posix.cc Move some logging related files to logging/ (#5387) 2019-05-31 17:23:59 -07:00
io_posix.h Optionally wait on bytes_per_sync to smooth I/O (#5183) 2019-04-22 11:51:39 -07:00
mock_env.cc Apply modernize-use-override (3) 2019-02-19 13:39:49 -08:00
mock_env.h Update all unique/shared_ptr instances to be qualified with namespace std (#4638) 2018-11-09 11:19:58 -08:00
mock_env_test.cc Move test related files under util/ to test_util/ (#5377) 2019-05-30 11:25:51 -07:00