From 9074b8d943d41b4539c78f1183128e61aee5485c Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 15 Oct 2023 00:19:13 +0200 Subject: Issue #2281 - Build LZ4 as C instead of including it as C++. --- mfbt/Compression.cpp | 12 ++---------- mfbt/moz.build | 13 ++----------- mfbt/objs.mozbuild | 2 ++ 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/mfbt/Compression.cpp b/mfbt/Compression.cpp index 6147d0d611..8dc2ec3d86 100644 --- a/mfbt/Compression.cpp +++ b/mfbt/Compression.cpp @@ -11,17 +11,9 @@ // corecrt_memory.h. #include -using namespace mozilla::Compression; - -namespace { - -extern "C" { - -#include "lz4.c" +#include "lz4.h" -} - -}/* anonymous namespace */ +using namespace mozilla::Compression; /* Our wrappers */ diff --git a/mfbt/moz.build b/mfbt/moz.build index 54b13f21b9..e4b294292d 100644 --- a/mfbt/moz.build +++ b/mfbt/moz.build @@ -124,20 +124,11 @@ SOURCES += mfbt_nonunified_src_cppsrcs DISABLE_STL_WRAPPING = True -# Suppress warnings in third-party LZ4 code. -# TODO: Remove these suppressions after bug 993267 is fixed. - -if CONFIG['GNU_CXX']: - SOURCES['/mfbt/Compression.cpp'].flags += ['-Wno-unused-function'] - CXXFLAGS += ['-Wno-error=shadow'] - if CONFIG['CLANG_CXX']: # Suppress warnings from third-party V8 Decimal code. SOURCES['/mfbt/decimal/Decimal.cpp'].flags += ['-Wno-implicit-fallthrough'] -if CONFIG['_MSC_VER']: - # Error 4804 is "'>' : unsafe use of type 'bool' in operation" - SOURCES['/mfbt/Compression.cpp'].flags += ['-wd4804'] - if CONFIG['MOZ_NEEDS_LIBATOMIC']: OS_LIBS += ['atomic'] + +DEFINES['LZ4LIB_VISIBILITY'] = '' diff --git a/mfbt/objs.mozbuild b/mfbt/objs.mozbuild index 8aed3d179f..e8fd522d79 100644 --- a/mfbt/objs.mozbuild +++ b/mfbt/objs.mozbuild @@ -28,9 +28,11 @@ mfbt_src_cppsrcs = [ # Compression.cpp cannot be built in unified mode because it pulls in Windows system headers. # Decimal.cpp doesn't build in unified mode with gcc. +# We build lz4 in C mode mfbt_nonunified_src_lcppsrcs = [ 'Compression.cpp', 'decimal/Decimal.cpp', + 'lz4.c', ] mfbt_nonunified_src_cppsrcs = [ -- cgit v1.2.3