litespeedtech / litespeedtech/lsmcd
CLANG 18 - base64.cpp: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 39
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Compiling lsmcd on AlmaLinux 9. I received an error on base64.cpp during compile as follows, though the error also occurs in several other files, depending how many parallel processes are used:
`base64.cpp:36:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`36 | register const char *pEncoded = encoded;`
`| ^~~~~~~~`
`base64.cpp:37:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`37 | register unsigned char e1, prev_e = 0;`
`| ^~~~~~~~`
`base64.cpp:37:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`37 | register unsigned char e1, prev_e = 0;`
`| ^~~~~~~~`
`base64.cpp:38:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`38 | register char phase = 0;`
`| ^~~~~~~~`
`base64.cpp:39:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`39 | register unsigned char *pDecoded = (unsigned char *)decoded;`
`| ^~~~~~~~`
`base64.cpp:40:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`40 | register const char *pEnd = encoded + size ;`
`| ^~~~~~~~`
`base64.cpp:44:9: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`44 | register int ch = *pEncoded++;`
`| ^~~~~~~~`
`base64.cpp:75:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`75 | register const unsigned char *pDecoded = (const unsigned char *)decoded;`
`| ^~~~~~~~`
`base64.cpp:76:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`76 | register constmv -f .deps/autobuf.Tpo .deps/autobuf.Po unsigned char *pEnd = (const unsigned char *)decoded + size`
`| ^~~~~~~~`
`base64.cpp:78:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`clang -DHAVE_CONFIG_H -I. -I../../src -I../../include -I../../src -I/usr/include -g -O2 -fstack-protector -MT blockbuf.o -MD -MP -MF .deps/blockbuf.Tpo -c -o blockbuf.o blockbuf.cpp`
`78 | register char *pEncoded = encoded;`
`| ^~~~~~~~`
`base64.cpp:79:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]`
`79 | register unsigned char ch;`
`| ^~~~~~~~`
`11 errors generated.`
`make[4]: *** [Makefile:600: base64.o] Error 1`
My `configure` command is:
`
CC="clang" CXX="clang" "LDFLAGS=" -fuse-ld=lld" CFLAGS=" -O2" ./configure --prefix=/usr/local/lsmcd
`
EL9 comes pre-installed with gcc 11:
`gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2)`
The packaged clang on EL9 is clang 18:
`
clang version 18.1.8 (AlmaLinux OS Foundation 18.1.8-3.el9)
`
I have attached my `config.log` file.
[config.log](https://github.com/user-attachments/files/18424651/config.log)
****
register pointers are only warnings in gcc, but fatal errors in clang.
Adding `CXXFLAGS="-Wno-register"` on the `configure` command line will allow clang to complete the compile without the errors, and will skip the warnings in gcc.
However, the solution for ISO C++ 17 should be to rename register to REGISTER, or avoid the register keyword all together.
gcc has used ISO C++ 17 since gcc 8. These warnings are being thrown for any modern compilers. Hopefully an update will rename register if ISO C++ 17 is detected.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the register declarations in base64.cpp and inspect the other source files reported during the clang build. Re-run configure and the compilation with clang 18, comparing the existing CXXFLAGS workaround and GCC output. Done means the project builds successfully with modern C++17 compilers without register-related errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100