summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2017-11-05 10:48:00 (GMT)
committerSylvestre Ledru <sylvestre@debian.org>2017-11-05 10:48:03 (GMT)
commitcca7618f09b0a98b05a27597f25fcdc68ab908ed (patch)
treeafd09f891479fe121f96691b16ab760772509d5a
parentcc4a109b0df7d12cfd0f26960ba3548d9b7915ba (diff)
downloadlz4-cca7618f09b0a98b05a27597f25fcdc68ab908ed.zip
lz4-cca7618f09b0a98b05a27597f25fcdc68ab908ed.tar.gz
lz4-cca7618f09b0a98b05a27597f25fcdc68ab908ed.tar.bz2
When building with a C++ compiler, remove the 'register' keyword to silent a warning
For example, with clang: lz4.c:XXX:36: error: 'register' storage class specifier is deprecated and incompatible with C++17 [-Werror,-Wdeprecated-register] static unsigned LZ4_NbCommonBytes (register reg_t val) ^~~~~~~~~
-rw-r--r--lib/lz4.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 5efcbc0..71acfce 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -85,6 +85,17 @@
#endif
+/*
+ * register is ignored when the code built with a C++ compiler
+ * Remove the keyword when built with C++ to silent the warning
+ */
+#ifdef __cplusplus
+# define REGISTER
+#else
+# define REGISTER register
+#endif
+
+
/*-************************************
* Dependency
**************************************/
@@ -330,7 +341,7 @@ static const int LZ4_minLength = (MFLIMIT+1);
/*-************************************
* Common functions
**************************************/
-static unsigned LZ4_NbCommonBytes (register reg_t val)
+static unsigned LZ4_NbCommonBytes (REGISTER reg_t val)
{
if (LZ4_isLittleEndian()) {
if (sizeof(val)==8) {