Manual interventions for clang-format util/ (#10870)

Summary:
Complements https://github.com/facebook/rocksdb/issues/10867 with some manual edits to avoid weird formatting or to avoid massive reformatting third party code.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10870

Test Plan: `make check` etc

Reviewed By: riversand963

Differential Revision: D40686526

Pulled By: pdillinger

fbshipit-source-id: 6af988fe4b0a8ae4a5992ec2c3c37fe67584226e
main
Peter Dillinger 2 years ago committed by Facebook GitHub Bot
parent 7fff38b1fe
commit a1a1dc6659
  1. 9
      util/compression.h
  2. 2
      util/crc32c_arm64.h
  3. 9
      util/murmurhash.cc
  4. 3
      util/xxhash.cc
  5. 11
      util/xxhash.h
  6. 4
      util/xxph3.h

@ -47,10 +47,12 @@
#if defined(ZSTD) #if defined(ZSTD)
#include <zstd.h> #include <zstd.h>
#if ZSTD_VERSION_NUMBER >= 10103 // v1.1.3+ // v1.1.3+
#if ZSTD_VERSION_NUMBER >= 10103
#include <zdict.h> #include <zdict.h>
#endif // ZSTD_VERSION_NUMBER >= 10103 #endif // ZSTD_VERSION_NUMBER >= 10103
#if ZSTD_VERSION_NUMBER >= 10400 // v1.4.0+ // v1.4.0+
#if ZSTD_VERSION_NUMBER >= 10400
#define ZSTD_STREAMING #define ZSTD_STREAMING
#endif // ZSTD_VERSION_NUMBER >= 10400 #endif // ZSTD_VERSION_NUMBER >= 10400
namespace ROCKSDB_NAMESPACE { namespace ROCKSDB_NAMESPACE {
@ -143,6 +145,7 @@ class ZSTDUncompressCachedData {
int64_t GetCacheIndex() const { return -1; } int64_t GetCacheIndex() const { return -1; }
void CreateIfNeeded() {} void CreateIfNeeded() {}
void InitFromCache(const ZSTDUncompressCachedData&, int64_t) {} void InitFromCache(const ZSTDUncompressCachedData&, int64_t) {}
private: private:
void ignore_padding__() { padding = nullptr; } void ignore_padding__() { padding = nullptr; }
}; };
@ -1256,7 +1259,7 @@ inline bool LZ4HC_Compress(const CompressionInfo& info,
size_t compression_dict_size = compression_dict.size(); size_t compression_dict_size = compression_dict.size();
if (compression_dict_data != nullptr) { if (compression_dict_data != nullptr) {
LZ4_loadDictHC(stream, compression_dict_data, LZ4_loadDictHC(stream, compression_dict_data,
static_cast<int>(compression_dict_size)); static_cast<int>(compression_dict_size));
} }
#if LZ4_VERSION_NUMBER >= 10700 // r129+ #if LZ4_VERSION_NUMBER >= 10700 // r129+

@ -18,6 +18,7 @@
#define crc32c_u16(crc, v) __crc32ch(crc, v) #define crc32c_u16(crc, v) __crc32ch(crc, v)
#define crc32c_u32(crc, v) __crc32cw(crc, v) #define crc32c_u32(crc, v) __crc32cw(crc, v)
#define crc32c_u64(crc, v) __crc32cd(crc, v) #define crc32c_u64(crc, v) __crc32cd(crc, v)
// clang-format off
#define PREF4X64L1(buffer, PREF_OFFSET, ITR) \ #define PREF4X64L1(buffer, PREF_OFFSET, ITR) \
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]" ::[v] "r"(buffer), \ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]" ::[v] "r"(buffer), \
[c] "I"((PREF_OFFSET) + ((ITR) + 0) * 64)); \ [c] "I"((PREF_OFFSET) + ((ITR) + 0) * 64)); \
@ -27,6 +28,7 @@
[c] "I"((PREF_OFFSET) + ((ITR) + 2) * 64)); \ [c] "I"((PREF_OFFSET) + ((ITR) + 2) * 64)); \
__asm__("PRFM PLDL1KEEP, [%x[v],%[c]]" ::[v] "r"(buffer), \ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]" ::[v] "r"(buffer), \
[c] "I"((PREF_OFFSET) + ((ITR) + 3) * 64)); [c] "I"((PREF_OFFSET) + ((ITR) + 3) * 64));
// clang-format on
#define PREF1KL1(buffer, PREF_OFFSET) \ #define PREF1KL1(buffer, PREF_OFFSET) \
PREF4X64L1(buffer, (PREF_OFFSET), 0) \ PREF4X64L1(buffer, (PREF_OFFSET), 0) \

@ -10,6 +10,7 @@
is under the MIT license. is under the MIT license.
*/ */
#include "murmurhash.h" #include "murmurhash.h"
#include "port/lang.h" #include "port/lang.h"
#if defined(__x86_64__) #if defined(__x86_64__)
@ -28,6 +29,7 @@ __attribute__((__no_sanitize__("alignment")))
__attribute__((__no_sanitize_undefined__)) __attribute__((__no_sanitize_undefined__))
#endif #endif
#endif #endif
// clang-format off
uint64_t MurmurHash64A ( const void * key, int len, unsigned int seed ) uint64_t MurmurHash64A ( const void * key, int len, unsigned int seed )
{ {
const uint64_t m = 0xc6a4a7935bd1e995; const uint64_t m = 0xc6a4a7935bd1e995;
@ -70,6 +72,7 @@ uint64_t MurmurHash64A ( const void * key, int len, unsigned int seed )
return h; return h;
} }
// clang-format on
#elif defined(__i386__) #elif defined(__i386__)
@ -85,7 +88,7 @@ uint64_t MurmurHash64A ( const void * key, int len, unsigned int seed )
// 1. It will not work incrementally. // 1. It will not work incrementally.
// 2. It will not produce the same results on little-endian and big-endian // 2. It will not produce the same results on little-endian and big-endian
// machines. // machines.
// clang-format off
unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed ) unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
{ {
// 'm' and 'r' are mixing constants generated offline. // 'm' and 'r' are mixing constants generated offline.
@ -136,6 +139,7 @@ unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
return h; return h;
} }
// clang-format on
#else #else
@ -143,7 +147,7 @@ unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
// //
// Same as MurmurHash2, but endian- and alignment-neutral. // Same as MurmurHash2, but endian- and alignment-neutral.
// Half the speed though, alas. // Half the speed though, alas.
// clang-format off
unsigned int MurmurHashNeutral2 ( const void * key, int len, unsigned int seed ) unsigned int MurmurHashNeutral2 ( const void * key, int len, unsigned int seed )
{ {
const unsigned int m = 0x5bd1e995; const unsigned int m = 0x5bd1e995;
@ -187,5 +191,6 @@ unsigned int MurmurHashNeutral2 ( const void * key, int len, unsigned int seed )
return h; return h;
} }
// clang-format on
#endif #endif

@ -36,11 +36,10 @@
* - xxHash source repository: https://github.com/Cyan4973/xxHash * - xxHash source repository: https://github.com/Cyan4973/xxHash
*/ */
/* /*
* xxhash.c instantiates functions defined in xxhash.h * xxhash.c instantiates functions defined in xxhash.h
*/ */
// clang-format off
#ifndef XXH_STATIC_LINKING_ONLY #ifndef XXH_STATIC_LINKING_ONLY
#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */
#endif // !defined(XXH_STATIC_LINKING_ONLY) #endif // !defined(XXH_STATIC_LINKING_ONLY)

@ -5,12 +5,15 @@
/* BEGIN RocksDB customizations */ /* BEGIN RocksDB customizations */
#ifndef XXH_STATIC_LINKING_ONLY #ifndef XXH_STATIC_LINKING_ONLY
#define XXH_STATIC_LINKING_ONLY 1 /* using xxhash.cc */ // Using compiled xxhash.cc
#endif // !defined(XXH_STATIC_LINKING_ONLY) #define XXH_STATIC_LINKING_ONLY 1
#endif // !defined(XXH_STATIC_LINKING_ONLY)
#ifndef XXH_NAMESPACE #ifndef XXH_NAMESPACE
#define XXH_NAMESPACE ROCKSDB_ #define XXH_NAMESPACE ROCKSDB_
#endif // !defined(XXH_NAMESPACE) #endif // !defined(XXH_NAMESPACE)
#include "port/lang.h" // for FALLTHROUGH_INTENDED, inserted as appropriate
// for FALLTHROUGH_INTENDED, inserted as appropriate
#include "port/lang.h"
/* END RocksDB customizations */ /* END RocksDB customizations */
// clang-format off // clang-format off

@ -47,13 +47,15 @@
/* BEGIN RocksDB customizations */ /* BEGIN RocksDB customizations */
#ifndef XXPH_STATIC_LINKING_ONLY #ifndef XXPH_STATIC_LINKING_ONLY
#define XXPH_STATIC_LINKING_ONLY 1 /* access experimental APIs like XXPH3 */ // Access experimental APIs
#define XXPH_STATIC_LINKING_ONLY 1
#endif #endif
#define XXPH_NAMESPACE ROCKSDB_ #define XXPH_NAMESPACE ROCKSDB_
#define XXPH_INLINE_ALL #define XXPH_INLINE_ALL
#include <cstring> #include <cstring>
/* END RocksDB customizations */ /* END RocksDB customizations */
// clang-format off
#if defined (__cplusplus) #if defined (__cplusplus)
extern "C" { extern "C" {
#endif #endif

Loading…
Cancel
Save