https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90835
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> --- does the existing availability hack work [below]? *if the person who originally put it into pr83531 doesn't post it soon - I plan to apply it anyway - having re-tested with 10.13/10.14(SDK2) * for the other things, if it's a beta, then perhaps there's some chance it will be fixed before issue. * we - unconditionally define __has_xxxxxx(x) 0 in Darwin's builtin defines - make more fix include hacks.. - implement __has_xxxxx() .. which would be nicer, but not sure who has time to do it .. diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index ef23e489e..d9b96faa9 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -194,6 +194,33 @@ fix = { _EndOfHeader_; }; +/* + * SDKs for 10.13 and 10.14 omit the definitions for API_AVAILABLE where + * __attribute__((availability)) is not supported. + */ +fix = { + hackname = darwin_api_availability; + mach = "*-*-darwin*"; + files = os/availability.h; + bypass = "__IPHONE_OS_VERSION_MIN_REQUIRED"; + select = + " *#define __API_AVAILABLE.*\n" + " *#define __API_DEPRECATED.*\n" + " *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n" + " *#define __API_UNAVAILABLE.*\n"; + c_fix = format; + c_fix_arg = + " #define API_AVAILABLE(...)\n" + " #define API_DEPRECATED(...)\n" + " #define API_DEPRECATED_WITH_REPLACEMENT(...)\n" + " #define API_UNAVAILABLE(...)\n"; + test_text = + "#define __API_AVAILABLE(...)\n" + "#define __API_DEPRECATED(...)\n" + "#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n" + "#define __API_UNAVAILABLE(...)\n"; +}; + /* * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n) */ diff --git a/fixincludes/tests/base/os/availability.h b/fixincludes/tests/base/os/availability.h new file mode 100644 index 000000000..e8696b14a --- /dev/null +++ b/fixincludes/tests/base/os/availability.h @@ -0,0 +1,18 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/availability.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_API_AVAILABILITY_CHECK ) + #define API_AVAILABLE(...) + #define API_DEPRECATED(...) + #define API_DEPRECATED_WITH_REPLACEMENT(...) + #define API_UNAVAILABLE(...) + +#endif /* DARWIN_API_AVAILABILITY_CHECK */