Opened 14 months ago

Last modified 3 weeks ago

#72471 assigned defect

djvulibre @ 3.5.28: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]

Reported by: acjones8 (Alex Jones) Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version: 2.10.7
Keywords: Cc: Dave-Allured (Dave Allured)
Port: djvulibre

Description

Aloha everyone,

I was building djvulibre as a dependency for emacs-mac-app, and the build failed with a compliant about C++17 no longer allowing the register keyword to be used. I'm using macports-clang-20 as my compiler for Macports on MacOS 15, with an M4 Mac Mini if that helps. I'll paste the exact error messages below:

In file included from GBitmap.cpp:63:
./GBitmap.h:623:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  623 |   register int z=*data++;
      |   ^~~~~~~~
./GBitmap.h:631:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  631 |   register int z=*data++;
      |   ^~~~~~~~
In file included from DjVuToPS.cpp:71:
./GBitmap.h:623:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  623 |   register int z=*data++;
      |   ^~~~~~~~
./GBitmap.h:631:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  631 |   register int z=*data++;
      |   ^~~~~~~~

My understanding is the permanent fix might be to submit a patch that removes the use of the register keyword, but in the meantime, I wonder if setting the port to an older C++ standard version might work? I'll give that a try soon...

Change History (3)

comment:1 Changed 14 months ago by jmroot (Joshua Root)

Owner: set to NicosPavlov
Status: newassigned

comment:2 Changed 3 weeks ago by Dave-Allured (Dave Allured)

I am not sure whether this is still an issue for djvulibre. The register keyword is deprecated starting with C++17, as implied by the error message.

However, if it is still in the code base, then a suggested fix is to use the compiler flag -Wno-register as a single-point mitigation to suppress these warnings. This would be better than code patching. Reference: https://emmtrix.com/wiki/Clang:Flag/-Wregister

comment:3 Changed 3 weeks ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added
Note: See TracTickets for help on using tickets.