зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1416183 - Build LZ4 as C instead of including it as C++. r=froydnj
Apply 63a7f34fee
to our copy of lz4.h to allow to flag the lz4 symbols as not exported.
--HG--
extra : rebase_source : d9aafb04a56c0ae3620e0c873f77d124386a41c4
This commit is contained in:
Родитель
26b5914e89
Коммит
a1ac099614
|
@ -12,27 +12,10 @@
|
|||
// corecrt_memory.h.
|
||||
#include <string>
|
||||
|
||||
// Because we wrap lz4.c in an anonymous namespace, all of its #includes
|
||||
// go in the anonymous namespace too. This would create conflicting
|
||||
// declarations for intrinsic functions that are internally defined
|
||||
// at top-level. Including intrin.h here prevents it from being included
|
||||
// later within the anonymous namespace.
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#include "lz4.h"
|
||||
|
||||
using namespace mozilla::Compression;
|
||||
|
||||
namespace {
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "lz4.c"
|
||||
|
||||
}
|
||||
|
||||
}/* anonymous namespace */
|
||||
|
||||
/* Our wrappers */
|
||||
|
||||
size_t
|
||||
|
|
24
mfbt/lz4.h
24
mfbt/lz4.h
|
@ -72,19 +72,23 @@ extern "C" {
|
|||
/*
|
||||
* LZ4_DLL_EXPORT :
|
||||
* Enable exporting of functions when building a Windows DLL
|
||||
* LZ4LIB_API :
|
||||
* LZ4LIB_VISIBILITY :
|
||||
* Control library symbols visibility.
|
||||
*/
|
||||
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
|
||||
# define LZ4LIB_API __declspec(dllexport)
|
||||
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
|
||||
# define LZ4LIB_API __declspec(dllimport) /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define LZ4LIB_API __attribute__ ((__visibility__ ("default")))
|
||||
#else
|
||||
# define LZ4LIB_API
|
||||
#ifndef LZ4LIB_VISIBILITY
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))
|
||||
# else
|
||||
# define LZ4LIB_VISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
|
||||
# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
|
||||
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
|
||||
# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
|
||||
#else
|
||||
# define LZ4LIB_API LZ4LIB_VISIBILITY
|
||||
#endif
|
||||
|
||||
|
||||
/*------ Version ------*/
|
||||
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
||||
|
|
|
@ -147,24 +147,16 @@ DEFINES['IMPL_MFBT'] = True
|
|||
SOURCES += [
|
||||
'Compression.cpp',
|
||||
'decimal/Decimal.cpp',
|
||||
'lz4.c',
|
||||
]
|
||||
|
||||
DisableStlWrapping()
|
||||
|
||||
# Suppress warnings in third-party LZ4 code.
|
||||
# TODO: Remove these suppressions after bug 993267 is fixed.
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
SOURCES['Compression.cpp'].flags += ['-Wno-unused-function']
|
||||
CXXFLAGS += ['-Wno-error=shadow']
|
||||
|
||||
if CONFIG['CLANG_CXX']:
|
||||
# Suppress warnings from third-party V8 Decimal code.
|
||||
SOURCES['decimal/Decimal.cpp'].flags += ['-Wno-implicit-fallthrough']
|
||||
|
||||
if CONFIG['_MSC_VER']:
|
||||
# Error 4804 is "'>' : unsafe use of type 'bool' in operation"
|
||||
SOURCES['Compression.cpp'].flags += ['-wd4804']
|
||||
|
||||
if CONFIG['MOZ_NEEDS_LIBATOMIC']:
|
||||
OS_LIBS += ['atomic']
|
||||
|
||||
DEFINES['LZ4LIB_VISIBILITY'] = ''
|
||||
|
|
Загрузка…
Ссылка в новой задаче