rocksdb/util
Nikhil Benesch 11c5d4741a cross-platform compatibility improvements
Summary:
We've had a couple CockroachDB users fail to build RocksDB on exotic platforms, so I figured I'd try my hand at solving these issues upstream. The problems stem from a) `USE_SSE=1` being too aggressive about turning on SSE4.2, even on toolchains that don't support SSE4.2 and b) RocksDB attempting to detect support for thread-local storage based on OS, even though it can vary by compiler on the same OS.

See the individual commit messages for details. Regarding SSE support, this PR should change virtually nothing for non-CMake based builds. `make`, `PORTABLE=1 make`, `USE_SSE=1 make`, and `PORTABLE=1 USE_SSE=1 make` function exactly as before, except that SSE support will be automatically disabled when a simple SSE4.2-using test program fails to compile, as it does on OpenBSD. (OpenBSD's ports GCC supports SSE4.2, but its binutils do not, so `__SSE_4_2__` is defined but an SSE4.2-using program will fail to assemble.) A warning is emitted in this case. The CMake build is modified to support the same set of options, except that `USE_SSE` is spelled `FORCE_SSE42` because `USE_SSE` is rather useless now that we can automatically detect SSE support, and I figure changing options in the CMake build is less disruptive than changing the non-CMake build.

I've tested these changes on all the platforms I can get my hands on (macOS, Windows MSVC, Windows MinGW, and OpenBSD) and it all works splendidly. Let me know if there's anything you object to—I obviously don't mean to break any of your build pipelines in the process of fixing ours downstream.
Closes https://github.com/facebook/rocksdb/pull/2199

Differential Revision: D5054042

Pulled By: yiwu-arbug

fbshipit-source-id: 938e1fc665c049c02ae15698e1409155b8e72171
2017-05-15 16:15:38 -07:00
..
aligned_buffer.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
allocator.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
arena_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
arena.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
arena.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
auto_roll_logger_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
auto_roll_logger.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
auto_roll_logger.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
autovector_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
autovector.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
bloom_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
bloom.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
build_version.cc.in Makefile: generate util/build_version.cc from .in file (#1384) 2016-10-25 11:31:39 -07:00
build_version.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
channel.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
coding_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
coding.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
coding.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
compaction_job_stats_impl.cc Single Delete Mismatch and Fallthrough statistics 2016-08-16 08:21:43 -07:00
comparator.cc do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
compression.h Remove use of deprecated LZ4 function 2016-11-21 12:24:14 -08:00
concurrent_arena.cc CoreLocalArray class 2017-05-10 18:25:36 -07:00
concurrent_arena.h CoreLocalArray class 2017-05-10 18:25:36 -07:00
core_local.h core-local array type conversions 2017-05-12 09:28:07 -07:00
crc32c_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
crc32c.cc cross-platform compatibility improvements 2017-05-15 16:15:38 -07:00
crc32c.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
delete_scheduler_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
delete_scheduler.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
delete_scheduler.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
dynamic_bloom_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
dynamic_bloom.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
dynamic_bloom.h Fix the wrong address for PREFETCH in DynamicBloom::Prefetch 2017-02-28 10:39:11 -08:00
event_logger_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
event_logger.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
event_logger.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
fault_injection_test_env.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
fault_injection_test_env.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
file_reader_writer_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
file_reader_writer.cc Roundup read bytes in ReadaheadRandomAccessFile 2017-05-05 12:14:14 -07:00
file_reader_writer.h Blob storage pr 2017-05-10 15:14:44 -07:00
file_util.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
file_util.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filelock_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filename.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filename.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filter_policy.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
hash_map.h Use more efficient hash map for deadlock detection 2016-11-19 11:39:15 -08:00
hash.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
hash.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
heap_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
heap.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
kv_map.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
log_buffer.cc travis: add Windows cross-compilation 2017-05-05 23:20:01 -07:00
log_buffer.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
log_write_bench.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
logging.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
memory_usage.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
mpsc.h Blob storage pr 2017-05-10 15:14:44 -07:00
murmurhash.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
murmurhash.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
mutexlock.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
random.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
random.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
rate_limiter_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
rate_limiter.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
rate_limiter.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
slice_transform_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
slice.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sst_file_manager_impl.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sst_file_manager_impl.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
status_message.cc Limit maximum memory used in the WriteBatch representation 2017-04-10 15:42:26 -07:00
status.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
stderr_logger.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
stop_watch.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
string_util.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
string_util.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sync_point.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sync_point.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testharness.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testharness.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testutil.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testutil.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_list_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_local_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_local.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_local.h cross-platform compatibility improvements 2017-05-15 16:15:38 -07:00
thread_operation.h Gcc 7 error expansion to defined 2016-12-13 18:39:14 -08:00
threadpool_imp.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
threadpool_imp.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
timer_queue_test.cc Blob storage pr 2017-05-10 15:14:44 -07:00
timer_queue.h Blob storage pr 2017-05-10 15:14:44 -07:00
transaction_test_util.cc Gcc-7 buffer size insufficient 2016-12-14 19:24:26 -08:00
transaction_test_util.h Fix AppVeyor build error 2016-03-15 10:57:33 -07:00
xxhash.cc Enable MS Warning C4804 : unsafe use of type 'bool' in operation 2015-11-18 16:23:19 -08:00
xxhash.h Prevent xxhash symbols from polluting global namespace 2015-03-12 12:07:10 -07:00