Skip to content

use <version> (introduced in C++20) instead of <ciso646> (deprecated)#121

Open
trougnouf wants to merge 1 commit intohank-ai:masterfrom
trougnouf:master
Open

use <version> (introduced in C++20) instead of <ciso646> (deprecated)#121
trougnouf wants to merge 1 commit intohank-ai:masterfrom
trougnouf:master

Conversation

@trougnouf
Copy link
Copy Markdown

@trougnouf trougnouf commented May 9, 2025

Use <version> (introduced in C++20) instead of <ciso646> (deprecated in C++17).

This fixes GCC15 compiler warnings in darknet, e.g.:

In file included from /home/trougnouf/aur/darknet-cpu/src/darknet/src-lib/darknet_internal.hpp:23,
                 from /home/trougnouf/aur/darknet-cpu/src/darknet/src-lib/col2im.cpp:2:
/usr/include/c++/15.1.1/ciso646:46:4: warning: #warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros" [-Wcpp]
   46 | #  warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros"
      |    ^~~~~~~

and also makes it possible to compile DarkHelp which failed due to -Werror

@stephanecharette
Copy link
Copy Markdown
Contributor

Thing is, Darknet currently uses C++17. The version header is not available until C++20.

@trougnouf
Copy link
Copy Markdown
Author

trougnouf commented May 27, 2025

Thing is, Darknet currently uses C++17. The version header is not available until C++20.

Wouldn't the preprocessor check take care of it?

#if __has_include(<version>)
#  include <version>
#else
#  include <ciso646>
#endif

Somehow this compiles with no complaint (w/ GCC15 and I assume C++17 since I didn't change anything else) whereas leaving ciso646 gives a deprecation warning which turns into a compilation error in programs that treat warnings as such.
(Alternatively DarkHelp would have to disable the -Werror flag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants