summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2017-11-06 21:56:44 (GMT)
committerGitHub <noreply@github.com>2017-11-06 21:56:44 (GMT)
commit263e398a52e8c11f9add2be8df29d48be16e3f93 (patch)
tree8e741a7cac42fd235c47291b7d9dd00d5668e2f7
parentcc4a109b0df7d12cfd0f26960ba3548d9b7915ba (diff)
parent4fed595dac0a10fb68c77a71370638ad958ccce8 (diff)
downloadlz4-263e398a52e8c11f9add2be8df29d48be16e3f93.zip
lz4-263e398a52e8c11f9add2be8df29d48be16e3f93.tar.gz
lz4-263e398a52e8c11f9add2be8df29d48be16e3f93.tar.bz2
Merge pull request #417 from sylvestre/dev
When building with a C++ compiler, remove the 'register' keyword to silent a warning
-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..64a2e82 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -85,6 +85,17 @@
#endif
+/*
+ * register is ignored when the code built with a C++-17 compiler
+ * Remove the keyword when built with C++-17 to silent the warning
+ */
+#if defined(__cplusplus) && __cplusplus > 201402L
+# 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) {