I'm looking at adding feature detection macros to Hedley. The idea is that it would basically be a portable version of things that you're likely to test for either with `__has_feature()/__has_extension()` on clang or in the build system. I'm leaning towards putting these in a second (optional) header that would be distributed alongside of hedley.h. The disadvantage there is that we wouldn't be able to use the feature test macros in hedley.h, but I think that would be acceptable since the alternative would explode the side of hedley.h. Since autotools generally creates `HAVE_*` preprocessor definitions, I'm thinking `HEDLEY_HAVE_*` for the names. As @travisdowns suggested on Twitter, the stuff you can use `__has_feature()/__has_extension()` with would be a good start, so here is a current list (based on `curl -s https://clang.llvm.org/docs/LanguageExtensions.html | grep -oP '__has_(feature|extension)\([0-9a-zA-Z_]+\)' | sort | uniq`) * __has_extension(attribute_deprecated_with_message) * __has_extension(attribute_ext_vector_type) * __has_extension(attribute_unavailable_with_message) * __has_extension(blocks) * __has_extension(c_alignas) * __has_extension(c_alignof) * __has_extension(c_atomic) * __has_extension(c_generic_selections) * __has_extension(c_static_assert) * __has_extension(c_thread_local) * __has_extension(cxx_access_control_sfinae) * __has_extension(cxx_aggregate_nsdmi) * __has_extension(cxx_alias_templates) * __has_extension(cxx_alignas) * __has_extension(cxx_alignof) * __has_extension(cxx_attributes) * __has_extension(cxx_auto_type) * __has_extension(cxx_binary_literals) * __has_extension(cxx_contextual_conversions) * __has_extension(cxx_decltype) * __has_extension(cxx_decltype_auto) * __has_extension(cxx_decltype_incomplete_return_types) * __has_extension(cxx_defaulted_functions) * __has_extension(cxx_default_function_template_args) * __has_extension(cxx_deleted_functions) * __has_extension(cxx_generic_lambdas) * __has_extension(cxx_init_captures) * __has_extension(cxx_inline_namespaces) * __has_extension(cxx_lambdas) * __has_extension(cxx_local_type_template_args) * __has_extension(cxx_noexcept) * __has_extension(cxx_nullptr) * __has_extension(cxx_override_control) * __has_extension(cxx_range_for) * __has_extension(cxx_reference_qualified_functions) * __has_extension(cxx_relaxed_constexpr) * __has_extension(cxx_return_type_deduction) * __has_extension(cxx_runtime_array) * __has_extension(cxx_rvalue_references) * __has_extension(cxx_static_assert) * __has_extension(cxx_strong_enums) * __has_extension(cxx_trailing_return) * __has_extension(cxx_variable_templates) * __has_extension(cxx_variadic_templates) * __has_extension(enumerator_attributes) * __has_extension(is_convertible_to) * __has_extension(pragma_clang_attribute_namespaces) * __has_feature(address_sanitizer) * __has_feature(c_alignas) * __has_feature(c_alignof) * __has_feature(c_atomic) * __has_feature(c_generic_selections) * __has_feature(c_static_assert) * __has_feature(c_thread_local) * __has_feature(cxx_access_control_sfinae) * __has_feature(cxx_aggregate_nsdmi) * __has_feature(cxx_alias_templates) * __has_feature(cxx_alignas) * __has_feature(cxx_alignof) * __has_feature(cxx_attributes) * __has_feature(cxx_auto_type) * __has_feature(cxx_binary_literals) * __has_feature(cxx_constexpr) * __has_feature(cxx_constexpr_string_builtins) * __has_feature(cxx_contextual_conversions) * __has_feature(cxx_decltype) * __has_feature(cxx_decltype_auto) * __has_feature(cxx_decltype_incomplete_return_types) * __has_feature(cxx_defaulted_functions) * __has_feature(cxx_default_function_template_args) * __has_feature(cxx_delegating_constructors) * __has_feature(cxx_deleted_functions) * __has_feature(cxx_exceptions) * __has_feature(cxx_explicit_conversions) * __has_feature(cxx_generalized_initializers) * __has_feature(cxx_generic_lambdas) * __has_feature(cxx_implicit_moves) * __has_feature(cxx_inheriting_constructors) * __has_feature(cxx_init_captures) * __has_feature(cxx_inline_namespaces) * __has_feature(cxx_lambdas) * __has_feature(cxx_local_type_template_args) * __has_feature(cxx_noexcept) * __has_feature(cxx_nonstatic_member_init) * __has_feature(cxx_nullptr) * __has_feature(cxx_override_control) * __has_feature(cxx_range_for) * __has_feature(cxx_raw_string_literals) * __has_feature(cxx_reference_qualified_functions) * __has_feature(cxx_relaxed_constexpr) * __has_feature(cxx_return_type_deduction) * __has_feature(cxx_rtti) * __has_feature(cxx_runtime_array) * __has_feature(cxx_rvalue_references) * __has_feature(cxx_static_assert) * __has_feature(cxx_strong_enums) * __has_feature(cxx_thread_local) * __has_feature(cxx_trailing_return) * __has_feature(cxx_unicode_literals) * __has_feature(cxx_unrestricted_unions) * __has_feature(cxx_user_literals) * __has_feature(cxx_variable_templates) * __has_feature(cxx_variadic_templates) * __has_feature(memory_sanitizer) * __has_feature(modules) * __has_feature(objc_arc) * __has_feature(objc_arc_fields) * __has_feature(objc_arc_weak) * __has_feature(objc_array_literals) * __has_feature(objc_default_synthesize_properties) * __has_feature(objc_dictionary_literals) * __has_feature(objc_fixed_enum) * __has_feature(objc_instancetype) * __has_feature(objc_protocol_qualifier_mangling) * __has_feature(objc_subscripting) * __has_feature(safe_stack) * __has_feature(thread_sanitizer) Obviously Hedley won't support them all. The objective C ones we can safely ignore, and for the clang-specific stuff there isn't really a reason not to just use `HEDLEY_HAS_FEATURE`. Also, several are for testing for things Hedley already supports, like static assertions… we could probably skip those since people can just unconditionally use the Hedley versions for maximum portability. The sanitizer ones could actually be useful since GCC defines (for example) `__SANITIZE_ADDRESS__` if asan is in use instead of supporting `__has_feature(address_sanitizer)`. This would also be extremely useful for non-standard stuff like statement expressions which are supported by many compilers, and features from later standards that a compiler may support (e.g., using C11 generic selections in C99). Anyways, if someone has requests for stuff not in that list, or something they would like me to prioritize, please speak up.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by nemequ and has received 0 comments.