summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-10-15 00:19:13 +0200
committerMoonchild <moonchild@palemoon.org>2023-11-05 13:15:56 +0100
commit9074b8d943d41b4539c78f1183128e61aee5485c (patch)
tree476228602ec616dffd478a07dffa111de1472c77
parent01c37ba21fddd39995f30e6e8842b7d1569c7c55 (diff)
downloaduxp-9074b8d943d41b4539c78f1183128e61aee5485c.tar.gz
Issue #2281 - Build LZ4 as C instead of including it as C++.
-rw-r--r--mfbt/Compression.cpp12
-rw-r--r--mfbt/moz.build13
-rw-r--r--mfbt/objs.mozbuild2
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 <string>
-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 = [