forked from mirrors/gecko-dev
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:
parent
26b5914e89
commit
a1ac099614
3 changed files with 18 additions and 39 deletions
|
|
@ -12,27 +12,10 @@
|
||||||
// corecrt_memory.h.
|
// corecrt_memory.h.
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// Because we wrap lz4.c in an anonymous namespace, all of its #includes
|
#include "lz4.h"
|
||||||
// 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
|
|
||||||
|
|
||||||
using namespace mozilla::Compression;
|
using namespace mozilla::Compression;
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
#include "lz4.c"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}/* anonymous namespace */
|
|
||||||
|
|
||||||
/* Our wrappers */
|
/* Our wrappers */
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
|
|
||||||
24
mfbt/lz4.h
24
mfbt/lz4.h
|
|
@ -72,19 +72,23 @@ extern "C" {
|
||||||
/*
|
/*
|
||||||
* LZ4_DLL_EXPORT :
|
* LZ4_DLL_EXPORT :
|
||||||
* Enable exporting of functions when building a Windows DLL
|
* Enable exporting of functions when building a Windows DLL
|
||||||
* LZ4LIB_API :
|
* LZ4LIB_VISIBILITY :
|
||||||
* Control library symbols visibility.
|
* Control library symbols visibility.
|
||||||
*/
|
*/
|
||||||
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
|
#ifndef LZ4LIB_VISIBILITY
|
||||||
# define LZ4LIB_API __declspec(dllexport)
|
# if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||||
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
|
# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))
|
||||||
# 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.*/
|
# else
|
||||||
#elif defined(__GNUC__) && (__GNUC__ >= 4)
|
# define LZ4LIB_VISIBILITY
|
||||||
# define LZ4LIB_API __attribute__ ((__visibility__ ("default")))
|
# endif
|
||||||
#else
|
#endif
|
||||||
# define LZ4LIB_API
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*------ Version ------*/
|
/*------ Version ------*/
|
||||||
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
||||||
|
|
|
||||||
|
|
@ -147,24 +147,16 @@ DEFINES['IMPL_MFBT'] = True
|
||||||
SOURCES += [
|
SOURCES += [
|
||||||
'Compression.cpp',
|
'Compression.cpp',
|
||||||
'decimal/Decimal.cpp',
|
'decimal/Decimal.cpp',
|
||||||
|
'lz4.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
DisableStlWrapping()
|
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']:
|
if CONFIG['CLANG_CXX']:
|
||||||
# Suppress warnings from third-party V8 Decimal code.
|
# Suppress warnings from third-party V8 Decimal code.
|
||||||
SOURCES['decimal/Decimal.cpp'].flags += ['-Wno-implicit-fallthrough']
|
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']:
|
if CONFIG['MOZ_NEEDS_LIBATOMIC']:
|
||||||
OS_LIBS += ['atomic']
|
OS_LIBS += ['atomic']
|
||||||
|
|
||||||
|
DEFINES['LZ4LIB_VISIBILITY'] = ''
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue