According to the CPP standard, <version> and the deprecation was added in CPP20 
[1] so would be best not to patch that part unconditionally in the gtest 
source. Maybe you could patch in a pragma to disable the warning instead?

Another option could be to drop the CPP standard check altogether and rely on 
the availability of __has_include.

[1]: https://en.cppreference.com/w/cpp/header/ciso646

On 27 January 2025 20:31:35 CET, "Sérgio Basto via devel" 
<devel@lists.fedoraproject.org> wrote:
>Hi,
>
>I just want check, if I'm thinking correctly before submitting a fix in
>gtest package 
>
>The problem is on Rawhide I have this warning that make other packages
>fail to build [1] 
>
>gtest source [2] source get __cplusplus value and include <version> or
>#include <ciso646>  depending on __cplusplus value .
>
>On rawhide I got the warning on Fedora 41 don't but __cplusplus of GCC
>compiler is the same (201703)
>
>My proposal is to change the comparison from 202002L to 201703L 
>-#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && \
>+#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
>
>What do you think ? 
>
>Best regards, 
>
>[1]
>/usr/include/c++/15/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"
>           |    ^~~~~~~
>
>[2]
>https://github.com/google/googletest/blob/main/googletest/include/gtest/internal/gtest-port.h#L274
>
>// Detect C++ feature test macros as gracefully as possible.
>// MSVC >= 19.15, Clang >= 3.4.1, and GCC >= 4.1.2 support feature test macros.
>#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && \
>    (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<version>))
>#include <version>  // C++20 and later
>#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<ciso646>))
>#include <ciso646>  // Pre-C++20
>#endif
>
>[3]
>#include <iostream>
>
>int main() {
>    std::cout << "__cplusplus: " << __cplusplus << std::endl;
>    return 0;
>}
>
>g++ check_cpp_version.cpp -o check_cpp_version && ./check_cpp_version
>__cplusplus: 201703
>
>
>
-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to