Skip to content

"extra tokens at end of #ifdef directive" warning for VIXL_HAS_DEPRECATED_WITH_MSG macro when using clang-cl #134

@anba

Description

@anba

The current definition for VIXL_HAS_DEPRECATED_WITH_MSG causes warnings for clang-cl, because clang-cl doesn't define __GNUC__, but defines __clang__ (llvm/llvm-project#53259):

vixl/src/utils-vixl.h

Lines 49 to 55 in c7b4c08

#ifdef __GNUC__
#define VIXL_HAS_DEPRECATED_WITH_MSG
#elif defined(__clang__)
#ifdef __has_extension(attribute_deprecated_with_message)
#define VIXL_HAS_DEPRECATED_WITH_MSG
#endif
#endif

Specifically #ifdef __has_extension(attribute_deprecated_with_message) isn't valid syntax, because #ifdef expects a single identifier.

I've changed the feature detection to this in the SpiderMonkey fork of VIXL:

#ifdef __has_extension
# if __has_extension(attribute_deprecated_with_message)
#  define VIXL_HAS_DEPRECATED_WITH_MSG
# endif
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions