diff options
author | Sylvestre Ledru <sylvestre@debian.org> | 2017-11-05 10:48:00 (GMT) |
---|---|---|
committer | Sylvestre Ledru <sylvestre@debian.org> | 2017-11-05 10:48:03 (GMT) |
commit | cca7618f09b0a98b05a27597f25fcdc68ab908ed (patch) | |
tree | afd09f891479fe121f96691b16ab760772509d5a | |
parent | cc4a109b0df7d12cfd0f26960ba3548d9b7915ba (diff) | |
download | lz4-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.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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) { |