Skip to content

Non-namespaced DEPRECATED macro is prone to conflicts #3058

Closed

Description

@leximayfield

Describe the bug
Macro DEPRECATED needlessly conflicts with other DEPRECATED declaration.

Expected behavior
Macro DEPRECATED is properly namespaced and does not collide with other DEPRECATED declarations.

Reproduction steps

// This would be defined elsewhere, like in a pre-compiled header of a larger program.
#define DEPRECATED(msg) __declspec(deprecated(msg))

#include "catch_amalgamated.hpp"

Platform information:
Catch v3.12.0, any platform/compiler.

Additional context
IMHO any Catch2 macros that are used by the implementation and not intended to be used inside a test case should be prefixed appropriately. In the case of DEPRECATED, I think it would be better off as CATCH_IMPL_DEPRECATED, as it appears that it is only used in headers and in the implementation.

The reason I'm running into this issue is that I have embedded Catch2 in a larger program, and run its test cases from a debug console. This larger program defines DEPRECATED for itself, and although it's...not great that this program does this, I think that for the specific case of a macro that isn't used when writing tests, it's better to prefix them, as is done in many other places inside the library.

I can work around the compile warning by undefining our DEPRECATED first, but it'd be nice if it was namespaced.

Activity

  1. horenmar commented on Jan 3, 2026

    @horenmar
    Member

    Yeah, that's a fair complaint; no idea why I didn't prefix the deprecation macro when I introduced it.

  2. added a commit that references this issue on Jan 6, 2026
    b59f4f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions