Skip to content

Commit

Permalink
add __has_attribute(ext_vector_type) check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Daniel committed Nov 15, 2024
1 parent f381c8a commit ec10b8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/doomtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ typedef byte lighttable_t;
#define inline __inline
#endif

#if defined(__clang__)
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#ifndef __has_extension
#define __has_extension __has_feature
#endif
#ifndef __has_attribute
#define __has_attribute __has_feature
#endif
#endif

#if defined(__GNUC__) || defined(__clang__)
#define PRINTF_ATTR(fmt, first) __attribute__((format(printf, fmt, first)))
#define PRINTF_ARG_ATTR(x) __attribute__((format_arg(x)))
Expand Down
4 changes: 2 additions & 2 deletions src/m_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "doomtype.h"

#ifdef __clang__
#if defined(__clang__) && __has_attribute(ext_vector_type)
typedef float vec __attribute__((ext_vector_type(3)));
#else
typedef struct
Expand All @@ -33,7 +33,7 @@ typedef struct
} vec;
#endif

#ifdef __clang__
#if defined(__clang__) && __has_attribute(ext_vector_type)
typedef float quat __attribute__((ext_vector_type(4)));
#else
typedef struct
Expand Down

0 comments on commit ec10b8f

Please sign in to comment.