Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created February 28, 2011 04:02
Show Gist options
  • Save ELLIOTTCABLE/846919 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/846919 to your computer and use it in GitHub Desktop.
Using LLVM/clang’s __has_attribute() macro
# if !defined(__has_attribute)
# define has_no_has_attribute
# define __has_attribute(x) 0
# endif //!defined(__has_attribute)
# if __has_attribute(constructor)
# define __constructor __attribute__((constructor))
# endif //__has_attribute(constructor)
# if __has_attribute(packed)
# define __packed __attribute__((packed))
# endif //__has_attribute(packed)
# if defined(has_no_has_attribute)
# undef has_no_has_attribute
# undef __has_attribute
# endif //!defined(__has_attribute)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment