Bug 281519 - devel/catch: fix build with clang 19
Summary: devel/catch: fix build with clang 19
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2024-09-15 15:57 UTC by Dimitry Andric
Modified: 2024-09-19 07:23 UTC (History)
0 users

See Also:
sunpoet: maintainer-feedback+


Attachments
devel/catch: fix build with clang 19 (3.84 KB, patch)
2024-09-15 15:58 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2024-09-15 15:57:20 UTC
Clang 19 has become more strict about C++ extensions, which results in:

  /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/Class.tests.cpp:83:1: error: passing no argument for the '...' parameter of a variadic macro is a C++20 extension [-Werror,-Wc++20-extensions]
     83 | TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
        | ^
  /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/catch.hpp:257:53: note: expanded from macro 'TEMPLATE_TEST_CASE_METHOD'
    257 | #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
        |                                                     ^
  /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:302:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD'
    302 |         INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
        |         ^
  /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:279:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2'
    279 |             INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
        |             ^
  /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:217:465: note: expanded from macro 'INTERNAL_CATCH_NTTP_GEN'
    217 | #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)
        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
  /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:100:9: note: macro 'INTERNAL_CATCH_VA_NARGS_IMPL' defined here
    100 | #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
        |         ^

This can be fixed by adding -Wno-error=c++20-extensions, which is
supported by both clang and gcc. Unfortunately adding it to CXXFLAGS
does not work, since that is prepended to the compiler flags in
CMakeLists.txt, so -Werror comes after it. Therefore, patch the
appropriate CMakeLists.txt file.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-09-15 15:58:43 UTC
Created attachment 253586 [details]
devel/catch: fix build with clang 19
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-09-19 04:41:53 UTC
LGTM. Thanks.
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-09-19 07:18:45 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4793dab964826c99c0c9e4143fe49c0a9c1d47d1

commit 4793dab964826c99c0c9e4143fe49c0a9c1d47d1
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-15 15:57:45 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-19 07:11:08 +0000

    devel/catch: fix build with clang 19

    Clang 19 has become more strict about C++ extensions, which results in:

      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/Class.tests.cpp:83:1: error: passing no argument for the '...' parameter of a variadic macro is a C++20 extension [-Werror,-Wc++20-extensions]
         83 | TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
            | ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/catch.hpp:257:53: note: expanded from macro 'TEMPLATE_TEST_CASE_METHOD'
        257 | #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
            |                                                     ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:302:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD'
        302 |         INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
            |         ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:279:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2'
        279 |             INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
            |             ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:217:465: note: expanded from macro 'INTERNAL_CATCH_NTTP_GEN'
        217 | #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)
            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:100:9: note: macro 'INTERNAL_CATCH_VA_NARGS_IMPL' defined here
        100 | #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
            |         ^

    This can be fixed by adding -Wno-error=c++20-extensions, which is
    supported by both clang and gcc. Unfortunately adding it to CXXFLAGS
    does not work, since that is prepended to the compiler flags in
    CMakeLists.txt, so -Werror comes after it. Therefore, patch the
    appropriate CMakeLists.txt file.

    PR:             281519
    Approved by:    sunpoet (maintainer)
    MFH:            2024Q3

 devel/catch/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-09-19 07:22:48 UTC
A commit in branch 2024Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=09b07372327bd18905fb4e9b5873146ba3ab5315

commit 09b07372327bd18905fb4e9b5873146ba3ab5315
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-15 15:57:45 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-19 07:22:04 +0000

    devel/catch: fix build with clang 19

    Clang 19 has become more strict about C++ extensions, which results in:

      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/Class.tests.cpp:83:1: error: passing no argument for the '...' parameter of a variadic macro is a C++20 extension [-Werror,-Wc++20-extensions]
         83 | TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
            | ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/catch.hpp:257:53: note: expanded from macro 'TEMPLATE_TEST_CASE_METHOD'
        257 | #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
            |                                                     ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:302:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD'
        302 |         INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
            |         ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:279:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2'
        279 |             INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
            |             ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:217:465: note: expanded from macro 'INTERNAL_CATCH_NTTP_GEN'
        217 | #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)
            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
      /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:100:9: note: macro 'INTERNAL_CATCH_VA_NARGS_IMPL' defined here
        100 | #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
            |         ^

    This can be fixed by adding -Wno-error=c++20-extensions, which is
    supported by both clang and gcc. Unfortunately adding it to CXXFLAGS
    does not work, since that is prepended to the compiler flags in
    CMakeLists.txt, so -Werror comes after it. Therefore, patch the
    appropriate CMakeLists.txt file.

    PR:             281519
    Approved by:    sunpoet (maintainer)
    MFH:            2024Q3

    (cherry picked from commit 4793dab964826c99c0c9e4143fe49c0a9c1d47d1)

 devel/catch/Makefile | 4 ++++
 1 file changed, 4 insertions(+)