Skip to content

Clang-Tidy complaint about re_snprintf #1207

@juha-h

Description

@juha-h

Android Studio Clang-Tidy complains about all re_snprintf calls. Example is below. Is this a bug in Clang-Tidy or a real issue with the macro?

Clang-Tidy: Conditional operator with identical true and false expressions
Declared in: re_fmt. h
Definition:
#define re_snprintf(str, size, fmt, ...)                                      \
	_re_snprintf_s((str), (size), (fmt), RE_VA_ARGS(__VA_ARGS__))
Replacement:
_re_snprintf_s((event_buf), (sizeof event_buf), ("call closed,%s,%s"),
        _Generic((0) ? (prm) : (prm),
                _Bool: sizeof(int),
                char: sizeof(int),
                unsigned char: sizeof(unsigned int),
                short: sizeof(int),
                unsigned short: sizeof(unsigned int),
                int: sizeof(int),
                unsigned int: sizeof(unsigned int),
                long: sizeof(long),
                unsigned long: sizeof(unsigned long),
                long long: sizeof(long long),
                unsigned long long: sizeof(unsigned long long),
                float: sizeof(double),
                double: sizeof(double),
                char const *: sizeof(char const *),
                char *: sizeof(char *),
                void const *: sizeof(void const *),
                void *: sizeof(void *),
                struct pl: sizeof(struct pl),
                default: sizeof(void *)),
        (prm),
        _Generic((0) ? (tone) : (tone),
                _Bool: sizeof(int),
                char: sizeof(int),
                unsigned char: sizeof(unsigned int),
                short: sizeof(int),
                unsigned short: sizeof(unsigned int),
                int: sizeof(int),
                unsigned int: sizeof(unsigned int),
                long: sizeof(long),
                unsigned long: sizeof(unsigned long),
                long long: sizeof(long long),
                unsigned long long: sizeof(unsigned long long),
                float: sizeof(double),
                double: sizeof(double),
                char const *: sizeof(char const *),
                char *: sizeof(char *),
                void const *: sizeof(void const *),
                void *: sizeof(void *),
                struct pl: sizeof(struct pl),
                default: sizeof(void *)),
        (tone), 0)

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