* [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) @ 2016-11-11 10:15 Rainer Orth 2016-11-11 11:19 ` Mike Stump [not found] ` <CAJMcOU-k7qAJC9qpPo1ybTjWpsP7aEQGgZLwaOWomoVqMyMn8A@mail.gmail.com> 0 siblings, 2 replies; 19+ messages in thread From: Rainer Orth @ 2016-11-11 10:15 UTC (permalink / raw) To: gcc-patches; +Cc: Bruce Korb [-- Attachment #1: Type: text/plain, Size: 2071 bytes --] Since the recent libsanitizer import, macOS 10.12 bootstrap is broken: * <os/trace.h> unconditionally uses the Blocks extension only support by Clang without the customary #if __BLOCKS__ guard: In file included from /vol/gcc/src/hg/trunk/local/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: /usr/include/os/trace.h:204:15: error: expected unqualified-id before '^' token typedef void (^os_trace_payload_t)(xpc_object_t xdict); ^ /usr/include/os/trace.h:204:15: error: expected ')' before '^' token In file included from /usr/include/Availability.h:184:0, from /usr/include/stdio.h:65, from /vol/gcc/src/hg/trunk/local/libsanitizer/sanitizer_common/sanitizer_mac.cc:21: To fix this, I wrap both the typedef and its single user. * <AvailabilityInternal.h> uses the __attribute__((availability)) extension unconditionally instead of wrapping it as is done in many other places: In file included from /usr/include/Availability.h:184:0, from /usr/include/stdio.h:65, from /vol/gcc/src/hg/trunk/local/libsanitizer/sanitizer_common/sanitizer_mac.cc:21: /var/gcc/regression/trunk/10.12-gcc/build/./gcc/include-fixed/os/trace.h:304:1: error: 'introduced' was not declared in this scope __API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) ^ I'm wrapping the internal __API_[ADU] macros as is done elsewhere. * I came across a dangling _EOFix_. The patch passes fixincludes make check (this time for real ;-) and restores macOS 10.12 bootstrap. Ok for mainline? Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2016-11-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR sanitizer/78267 * inclhack.def (darwin_availabilityinternal, darwin_os_trace_1) (darwin_os_trace_2): New fixes. (hpux_stdint_least_fast): Remove spurious _EOFix_. * fixincl.x: Regenerate. * tests/bases/AvailabilityInternal.h: New file. * tests/bases/os/trace.h: New file. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: macos-fixincludes-AvailabilityInternal.patch --] [-- Type: text/x-patch, Size: 4626 bytes --] # HG changeset patch # Parent 38420045cf6aa616f517ca5fcfd15f2b55e68cf0 Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1338,6 +1338,32 @@ fix = { }; /* + * macOS 10.12 <AvailabilityInternal.h> uses __attribute__((availability)) + * unconditionally. + */ +fix = { + hackname = darwin_availabilityinternal; + mach = "*-*-darwin*"; + files = AvailabilityInternal.h; + select = "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*"; + c_fix = format; + c_fix_arg = <<- _EOFix_ + #if defined(__has_attribute) + #if __has_attribute(availability) + %0 + #else + #define %1 + #endif + #else + #define %1 + #endif + _EOFix_; + + test_text = "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n" + "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))"; +}; + +/* * For the AAB_darwin7_9_long_double_funcs fix to be useful, * you have to not use "" includes. */ @@ -1410,6 +1436,44 @@ fix = { }; /* + * macOS 10.12 <os/trace.h> os_trace_payload_t typedef uses Blocks + * extension without guard. + */ +fix = { + hackname = darwin_os_trace_1; + mach = "*-*-darwin*"; + files = os/trace.h; + select = "typedef.*\\^os_trace_payload_t.*"; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);"; +}; + +/* + * In macOS 10.12 <os/trace.h>, need to guard users of os_trace_payload_t + * typedef, too. + */ +fix = { + hackname = darwin_os_trace_2; + mach = "*-*-darwin*"; + files = os/trace.h; + select = <<- _EOSelect_ + __API_.* + OS_EXPORT.* + .* + _os_trace.*os_trace_payload_t payload); + _EOSelect_; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- _EOText_ + __API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) + OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED + void + _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); + _EOText_; +}; + +/* * __private_extern__ doesn't exist in FSF GCC. Even if it did, * why would you ever put it in a system header file? */ @@ -2638,7 +2702,6 @@ fix = { c-fix-arg = "# define UINT_%164_MAX __UINT64_MAX__"; test-text = "# define UINT_FAST64_MAX ULLONG_MAX\n" "# define UINT_LEAST64_MAX ULLONG_MAX\n"; - _EOFix_; }; /* diff --git a/fixincludes/tests/base/AvailabilityInternal.h b/fixincludes/tests/base/AvailabilityInternal.h new file mode 100644 --- /dev/null +++ b/fixincludes/tests/base/AvailabilityInternal.h @@ -0,0 +1,31 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/AvailabilityInternal.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_AVAILABILITYINTERNAL_CHECK ) +#if defined(__has_attribute) + #if __has_attribute(availability) +#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x))) + #else + #define __API_A(x) + #endif +#else + #define __API_A(x) +#endif +#if defined(__has_attribute) + #if __has_attribute(availability) +#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))) + #else + #define __API_D(msg,x) + #endif +#else + #define __API_D(msg,x) +#endif +#endif /* DARWIN_AVAILABILITYINTERNAL_CHECK */ diff --git a/fixincludes/tests/base/os/trace.h b/fixincludes/tests/base/os/trace.h new file mode 100644 --- /dev/null +++ b/fixincludes/tests/base/os/trace.h @@ -0,0 +1,26 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/trace.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OS_TRACE_1_CHECK ) +#if __BLOCKS__ +typedef void (^os_trace_payload_t)(xpc_object_t xdict); +#endif +#endif /* DARWIN_OS_TRACE_1_CHECK */ + + +#if defined( DARWIN_OS_TRACE_2_CHECK ) +#if __BLOCKS__ +__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) +OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED +void +_os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); +#endif +#endif /* DARWIN_OS_TRACE_2_CHECK */ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 10:15 [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) Rainer Orth @ 2016-11-11 11:19 ` Mike Stump 2016-11-11 16:17 ` Iain Sandoe 2016-11-11 21:25 ` Bruce Korb [not found] ` <CAJMcOU-k7qAJC9qpPo1ybTjWpsP7aEQGgZLwaOWomoVqMyMn8A@mail.gmail.com> 1 sibling, 2 replies; 19+ messages in thread From: Mike Stump @ 2016-11-11 11:19 UTC (permalink / raw) To: Rainer Orth; +Cc: gcc-patches, Bruce Korb On Nov 11, 2016, at 2:15 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: > The patch passes fixincludes make check (this time for real ;-) and > restores macOS 10.12 bootstrap. No objections from me. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 11:19 ` Mike Stump @ 2016-11-11 16:17 ` Iain Sandoe 2016-11-11 16:50 ` Rainer Orth 2016-11-11 21:25 ` Bruce Korb 1 sibling, 1 reply; 19+ messages in thread From: Iain Sandoe @ 2016-11-11 16:17 UTC (permalink / raw) To: Rainer Orth; +Cc: GCC Patches, Bruce Korb Hi Rainer, Thanks for the patch! > On 11 Nov 2016, at 11:18, Mike Stump <mikestump@comcast.net> wrote: > > On Nov 11, 2016, at 2:15 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >> The patch passes fixincludes make check (this time for real ;-) and >> restores macOS 10.12 bootstrap. > > No objections from me. On x86_64-darwin14, there still seem to be fails /usr/include/os/base.h /usr/include/dispatch/dispatch.h /usr/include/dispatch/object.h of kinds __has_extension() and block syntax. (I haven’t had a chance to check any other OS revs yet). Iain ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 16:17 ` Iain Sandoe @ 2016-11-11 16:50 ` Rainer Orth 2016-11-11 16:58 ` Iain Sandoe 0 siblings, 1 reply; 19+ messages in thread From: Rainer Orth @ 2016-11-11 16:50 UTC (permalink / raw) To: Iain Sandoe; +Cc: GCC Patches, Bruce Korb Hi Iain, >> On 11 Nov 2016, at 11:18, Mike Stump <mikestump@comcast.net> wrote: >> >> On Nov 11, 2016, at 2:15 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >>> The patch passes fixincludes make check (this time for real ;-) and >>> restores macOS 10.12 bootstrap. >> >> No objections from me. > > On x86_64-darwin14, there still seem to be fails > > /usr/include/os/base.h > /usr/include/dispatch/dispatch.h > /usr/include/dispatch/object.h > > of kinds __has_extension() and block syntax. > > (I haven’t had a chance to check any other OS revs yet). I don't have access to anything but Darwin 11 and 16, so I can't help directly. Maybe, if you can send (or attach to the PR) the specific errors and problematic headers (or point to copies on opensource.apple.com), I can help with the fixincludes part. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 16:50 ` Rainer Orth @ 2016-11-11 16:58 ` Iain Sandoe 2016-11-11 17:01 ` Rainer Orth 0 siblings, 1 reply; 19+ messages in thread From: Iain Sandoe @ 2016-11-11 16:58 UTC (permalink / raw) To: Rainer Orth; +Cc: GCC Patches, Bruce Korb > On 11 Nov 2016, at 16:50, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: > > Hi Iain, > >>> On 11 Nov 2016, at 11:18, Mike Stump <mikestump@comcast.net> wrote: >>> >>> On Nov 11, 2016, at 2:15 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >>>> The patch passes fixincludes make check (this time for real ;-) and >>>> restores macOS 10.12 bootstrap. >>> >>> No objections from me. >> >> On x86_64-darwin14, there still seem to be fails >> >> /usr/include/os/base.h >> /usr/include/dispatch/dispatch.h >> /usr/include/dispatch/object.h >> >> of kinds __has_extension() and block syntax. >> >> (I haven’t had a chance to check any other OS revs yet). > > I don't have access to anything but Darwin 11 and 16, so I can't help > directly. OK. Only the dispatch/ ones are present on Darwin11 (did that bootstrap OK for you? if so likely 10.6 will be OK too - save me checking). > Maybe, if you can send (or attach to the PR) the specific > errors and problematic headers (or point to copies on > opensource.apple.com), I can help with the fixincludes part. I don’t have a Darwin16 system live at present, so can’t compare, but os/base.h is present on Darwin15 (so i’d expect it to be in the Darwin16 SDK) I’ll see if I can take an initial pass at it over the w/e and post to the PR. Iain ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 16:58 ` Iain Sandoe @ 2016-11-11 17:01 ` Rainer Orth 0 siblings, 0 replies; 19+ messages in thread From: Rainer Orth @ 2016-11-11 17:01 UTC (permalink / raw) To: Iain Sandoe; +Cc: GCC Patches, Bruce Korb Hi Iain, >> On 11 Nov 2016, at 16:50, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >> >> Hi Iain, >> >>>> On 11 Nov 2016, at 11:18, Mike Stump <mikestump@comcast.net> wrote: >>>> >>>> On Nov 11, 2016, at 2:15 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> >>>> wrote: >>>>> The patch passes fixincludes make check (this time for real ;-) and >>>>> restores macOS 10.12 bootstrap. >>>> >>>> No objections from me. >>> >>> On x86_64-darwin14, there still seem to be fails >>> >>> /usr/include/os/base.h >>> /usr/include/dispatch/dispatch.h >>> /usr/include/dispatch/object.h >>> >>> of kinds __has_extension() and block syntax. >>> >>> (I haven’t had a chance to check any other OS revs yet). >> >> I don't have access to anything but Darwin 11 and 16, so I can't help >> directly. > > OK. Only the dispatch/ ones are present on Darwin11 > > (did that bootstrap OK for you? if so likely 10.6 will be OK too - save me > checking). 10.7 did without issues. >> Maybe, if you can send (or attach to the PR) the specific >> errors and problematic headers (or point to copies on >> opensource.apple.com), I can help with the fixincludes part. > > I don’t have a Darwin16 system live at present, so can’t compare, but > os/base.h is present on Darwin15 (so i’d expect it to be in the Darwin16 > SDK) It is indeed. > I’ll see if I can take an initial pass at it over the w/e and post to the PR. Fine. I'm sure we can fix Apple's mistakes here, but it would probably help to file bugs with them for everything we find. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 11:19 ` Mike Stump 2016-11-11 16:17 ` Iain Sandoe @ 2016-11-11 21:25 ` Bruce Korb 2016-11-18 10:45 ` Rainer Orth 1 sibling, 1 reply; 19+ messages in thread From: Bruce Korb @ 2016-11-11 21:25 UTC (permalink / raw) To: Mike Stump; +Cc: Rainer Orth, GCC Patches On Fri, Nov 11, 2016 at 3:18 AM, Mike Stump <mikestump@comcast.net> wrote: > > No objections from me. > Or me. Thanks! ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-11 21:25 ` Bruce Korb @ 2016-11-18 10:45 ` Rainer Orth 2016-11-18 17:23 ` Bruce Korb 2016-11-18 17:42 ` Mike Stump 0 siblings, 2 replies; 19+ messages in thread From: Rainer Orth @ 2016-11-18 10:45 UTC (permalink / raw) To: Bruce Korb; +Cc: Mike Stump, GCC Patches [-- Attachment #1: Type: text/plain, Size: 1809 bytes --] Hi Bruce, Mike, > On Fri, Nov 11, 2016 at 3:18 AM, Mike Stump <mikestump@comcast.net> wrote: >> >> No objections from me. >> > Or me. Thanks! as discussed at length in the PR, the fixincludes route alone isn't enough to get libsanitizer to build on Darwin 15: we stay with undefined references to a function which had to fixinclude'd out due to use of the Blocks extension. On closer inspection, it turns out that the Darwin 16 <os/trace.h> effectively disables os_trace unless using clang >= 7.3. So there's no point in jumping through hoops to achieve the same with a large effort. OTOH, the fixes in my fixincludes patch fix real incompatibilities between Darwin headers an GCC, so we agreed to keep them even if libsanitizer would build without. So the current suggestion is to combine my fixincludes patch and Jack's patch to disable <os/trace.h> use if !__BLOCKS__. Bootstrapped without regressions on Darwin 16 by myself, and on 15 and 14 by Jack. I guess this is ok for mainline now to restore bootstrap? It may be that we add some more fixincludes fixes later, even if not required for libsanitizer. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2016-11-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR sanitizer/78267 * inclhack.def (darwin_availabilityinternal, darwin_os_trace_1) (darwin_os_trace_2, darwin_os_trace_3): New fixes. (hpux_stdint_least_fast): Remove spurious _EOFix_. * fixincl.x: Regenerate. * tests/bases/AvailabilityInternal.h: New file. * tests/bases/os/trace.h: New file. 2016-11-14 Jack Howarth <howarth.at.gcc@gmail.com> PR sanitizer/78267 * sanitizer_common/sanitizer_mac.cc: Include <os/trace.h> only if compiler supports blocks extension. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: macos-fixincludes-AvailabilityInternal.patch --] [-- Type: text/x-patch, Size: 6100 bytes --] # HG changeset patch # Parent 14eb543b5cb5e7a2bdea7430e3bf3b771bf0e54f Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1338,6 +1338,32 @@ fix = { }; /* + * macOS 10.12 <AvailabilityInternal.h> uses __attribute__((availability)) + * unconditionally. + */ +fix = { + hackname = darwin_availabilityinternal; + mach = "*-*-darwin*"; + files = AvailabilityInternal.h; + select = "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*"; + c_fix = format; + c_fix_arg = <<- _EOFix_ + #if defined(__has_attribute) + #if __has_attribute(availability) + %0 + #else + #define %1 + #endif + #else + #define %1 + #endif + _EOFix_; + + test_text = "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n" + "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))"; +}; + +/* * For the AAB_darwin7_9_long_double_funcs fix to be useful, * you have to not use "" includes. */ @@ -1410,6 +1436,62 @@ fix = { }; /* + * Mac OS X 10.11 <os/trace.h> uses attribute on function definition. + */ +fix = { + hackname = darwin_os_trace_1; + mach = "*-*-darwin*"; + files = os/trace.h; + select = "^(_os_trace_verify_printf.*) (__attribute__.*)"; + c_fix = format; + c_fix_arg = "%1"; + test_text = "_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2)))"; +}; + +/* + * Mac OS X 10.1[012] <os/trace.h> os_trace_payload_t typedef uses Blocks + * extension without guard. + */ +fix = { + hackname = darwin_os_trace_2; + mach = "*-*-darwin*"; + files = os/trace.h; + select = "typedef.*\\^os_trace_payload_t.*"; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);"; +}; + +/* + * In Mac OS X 10.1[012] <os/trace.h>, need to guard users of + * os_trace_payload_t typedef, too. + */ +fix = { + hackname = darwin_os_trace_3; + mach = "*-*-darwin*"; + files = os/trace.h; + select = <<- _EOSelect_ + __(API|OSX)_.* + OS_EXPORT.* + .* + _os_trace.*os_trace_payload_t payload); + _EOSelect_; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- _EOText_ + __API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) + OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED + void + _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); + + __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) + OS_EXPORT OS_NOTHROW + void + _os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload); + _EOText_; +}; + +/* * __private_extern__ doesn't exist in FSF GCC. Even if it did, * why would you ever put it in a system header file? */ @@ -2638,7 +2720,6 @@ fix = { c-fix-arg = "# define UINT_%164_MAX __UINT64_MAX__"; test-text = "# define UINT_FAST64_MAX ULLONG_MAX\n" "# define UINT_LEAST64_MAX ULLONG_MAX\n"; - _EOFix_; }; /* diff --git a/fixincludes/tests/base/AvailabilityInternal.h b/fixincludes/tests/base/AvailabilityInternal.h new file mode 100644 --- /dev/null +++ b/fixincludes/tests/base/AvailabilityInternal.h @@ -0,0 +1,31 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/AvailabilityInternal.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_AVAILABILITYINTERNAL_CHECK ) +#if defined(__has_attribute) + #if __has_attribute(availability) +#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x))) + #else + #define __API_A(x) + #endif +#else + #define __API_A(x) +#endif +#if defined(__has_attribute) + #if __has_attribute(availability) +#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))) + #else + #define __API_D(msg,x) + #endif +#else + #define __API_D(msg,x) +#endif +#endif /* DARWIN_AVAILABILITYINTERNAL_CHECK */ diff --git a/fixincludes/tests/base/os/trace.h b/fixincludes/tests/base/os/trace.h new file mode 100644 --- /dev/null +++ b/fixincludes/tests/base/os/trace.h @@ -0,0 +1,38 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/trace.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OS_TRACE_1_CHECK ) +_os_trace_verify_printf(const char *msg, ...) +#endif /* DARWIN_OS_TRACE_1_CHECK */ + + +#if defined( DARWIN_OS_TRACE_2_CHECK ) +#if __BLOCKS__ +typedef void (^os_trace_payload_t)(xpc_object_t xdict); +#endif +#endif /* DARWIN_OS_TRACE_2_CHECK */ + + +#if defined( DARWIN_OS_TRACE_3_CHECK ) +#if __BLOCKS__ +__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) +OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED +void +_os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); +#endif + +#if __BLOCKS__ +__OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) +OS_EXPORT OS_NOTHROW +void +_os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload); +#endif +#endif /* DARWIN_OS_TRACE_3_CHECK */ diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cc b/libsanitizer/sanitizer_common/sanitizer_mac.cc --- a/libsanitizer/sanitizer_common/sanitizer_mac.cc +++ b/libsanitizer/sanitizer_common/sanitizer_mac.cc @@ -34,7 +34,7 @@ extern char **environ; #endif -#if defined(__has_include) && __has_include(<os/trace.h>) +#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__BLOCKS__) #define SANITIZER_OS_TRACE 1 #include <os/trace.h> #else ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-18 10:45 ` Rainer Orth @ 2016-11-18 17:23 ` Bruce Korb 2016-11-18 17:42 ` Mike Stump 1 sibling, 0 replies; 19+ messages in thread From: Bruce Korb @ 2016-11-18 17:23 UTC (permalink / raw) To: Rainer Orth; +Cc: Mike Stump, GCC Patches I think restoring bootstrap is likely a good thing. On Fri, Nov 18, 2016 at 2:45 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote: > > I guess this is ok for mainline now to restore bootstrap? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-18 10:45 ` Rainer Orth 2016-11-18 17:23 ` Bruce Korb @ 2016-11-18 17:42 ` Mike Stump 2016-11-18 19:25 ` Bruce Korb 2016-11-21 9:52 ` Rainer Orth 1 sibling, 2 replies; 19+ messages in thread From: Mike Stump @ 2016-11-18 17:42 UTC (permalink / raw) To: Rainer Orth; +Cc: Bruce Korb, GCC Patches On Nov 18, 2016, at 2:45 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: > So the current suggestion is to combine my fixincludes patch and Jack's > patch to disable <os/trace.h> use if !__BLOCKS__. > I guess this is ok for mainline now to restore bootstrap? I think we are down to everyone likes this, Ok. The big question is, does this need a back port? If you fix includes virtual members or data members of C/C++ classes, just be careful disappearing content as that can change the layout of the structure or class. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-18 17:42 ` Mike Stump @ 2016-11-18 19:25 ` Bruce Korb 2016-11-21 9:55 ` Rainer Orth 2016-11-21 9:52 ` Rainer Orth 1 sibling, 1 reply; 19+ messages in thread From: Bruce Korb @ 2016-11-18 19:25 UTC (permalink / raw) To: Mike Stump; +Cc: Rainer Orth, GCC Patches On Fri, Nov 18, 2016 at 9:42 AM, Mike Stump <mikestump@comcast.net> wrote: > On Nov 18, 2016, at 2:45 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >> So the current suggestion is to combine my fixincludes patch and Jack's >> patch to disable <os/trace.h> use if !__BLOCKS__. > >> I guess this is ok for mainline now to restore bootstrap? > > I think we are down to everyone likes this, Ok. The big question is, does this need a back port? My thinking on that subject is that since include fixes do not directly affect the compiler and, instead, facilitate its use on various platforms, it is therefore reasonably safe to back port. Especially if adequate guards (selection tests) are included in the fix to prevent it from taking action on the wrong files. But I also think it is really a "steering committee" decision. For me, I think it is safe enough. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-18 19:25 ` Bruce Korb @ 2016-11-21 9:55 ` Rainer Orth 0 siblings, 0 replies; 19+ messages in thread From: Rainer Orth @ 2016-11-21 9:55 UTC (permalink / raw) To: Bruce Korb; +Cc: Mike Stump, GCC Patches Hi Bruce, > On Fri, Nov 18, 2016 at 9:42 AM, Mike Stump <mikestump@comcast.net> wrote: >> On Nov 18, 2016, at 2:45 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >>> So the current suggestion is to combine my fixincludes patch and Jack's >>> patch to disable <os/trace.h> use if !__BLOCKS__. >> >>> I guess this is ok for mainline now to restore bootstrap? >> >> I think we are down to everyone likes this, Ok. The big question is, >> does this need a back port? > > My thinking on that subject is that since include fixes do not directly affect > the compiler and, instead, facilitate its use on various platforms, it > is therefore > reasonably safe to back port. Especially if adequate guards (selection tests) > are included in the fix to prevent it from taking action on the wrong files. > But I also think it is really a "steering committee" decision. > > For me, I think it is safe enough. Agreed: especially for the WIP 10.10 and 10.11 fixes I've found instances where people had stumbled across incompatibilities in contexts other than libsanitizer. So the fixes would improve their user experience regardless :-) Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-18 17:42 ` Mike Stump 2016-11-18 19:25 ` Bruce Korb @ 2016-11-21 9:52 ` Rainer Orth 1 sibling, 0 replies; 19+ messages in thread From: Rainer Orth @ 2016-11-21 9:52 UTC (permalink / raw) To: Mike Stump; +Cc: Bruce Korb, GCC Patches Hi Mike, > On Nov 18, 2016, at 2:45 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >> So the current suggestion is to combine my fixincludes patch and Jack's >> patch to disable <os/trace.h> use if !__BLOCKS__. > >> I guess this is ok for mainline now to restore bootstrap? > > I think we are down to everyone likes this, Ok. The big question is, does > this need a back port? while they are not necessary to fix the libsanitizer bootstrap failure, they fix genuine header problems, so I think they're desirable. My plan has been to look into the problems discovered in 10.10 and 10.11 headers while developing this one, get them into mainline as time permits and backport the whole bunch afterwards. > If you fix includes virtual members or data members of C/C++ classes, just > be careful disappearing content as that can change the layout of the > structure or class. Understood. So far, the fixes have just removed attributes not supported by GCC, or types using such extensions and function declarations using them. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <CAJMcOU-k7qAJC9qpPo1ybTjWpsP7aEQGgZLwaOWomoVqMyMn8A@mail.gmail.com>]
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) [not found] ` <CAJMcOU-k7qAJC9qpPo1ybTjWpsP7aEQGgZLwaOWomoVqMyMn8A@mail.gmail.com> @ 2016-11-13 10:53 ` Rainer Orth [not found] ` <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com> 0 siblings, 1 reply; 19+ messages in thread From: Rainer Orth @ 2016-11-13 10:53 UTC (permalink / raw) To: Jack Howarth; +Cc: GCC Patches, Bruce Korb Hi Jack, > On darwin15, the proposed patch is insufficient to restore the bootstrap > (after running genfixes in the fixincludes directory) unless I also apply > the previously proposed change... no wonder: it's only been tested on darwin16. Care to explain what error you're seeing? Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com>]
* Fwd: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) [not found] ` <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com> @ 2016-11-13 18:24 ` Jack Howarth 2016-11-14 14:11 ` Rainer Orth [not found] ` <CAJMcOU8m_8oCKpV4RD=1wo=PEs9fBcP52gyD1wtsO4B1v85dfQ@mail.gmail.com> 2 siblings, 0 replies; 19+ messages in thread From: Jack Howarth @ 2016-11-13 18:24 UTC (permalink / raw) To: GCC Patches ---------- Forwarded message ---------- From: Jack Howarth <howarth.at.gcc@gmail.com> Date: Sun, Nov 13, 2016 at 1:19 PM Subject: Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) To: Rainer Orth <ro@cebitec.uni-bielefeld.de> Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Bruce Korb <bkorb@gnu.org> On Sun, Nov 13, 2016 at 5:53 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote: > > Hi Jack, > > > On darwin15, the proposed patch is insufficient to restore the bootstrap > > (after running genfixes in the fixincludes directory) unless I also apply > > the previously proposed change... > > no wonder: it's only been tested on darwin16. Care to explain what > error you're seeing? > The failure that I see on darwin15 using your proposed patches and executing genfixes in fixincludes before the build is... libtool: compile: /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/./gcc/xgcc -shared-libgcc -B/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/./gcc -nostdinc++ -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/src -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/libsupc++/.libs -B/sw/lib/gcc7/x86_64-apple-darwin15.6.0/bin/ -B/sw/lib/gcc7/x86_64-apple-darwin15.6.0/lib/ -isystem /sw/lib/gcc7/x86_64-apple-darwin15.6.0/include -isystem /sw/lib/gcc7/x86_64-apple-darwin15.6.0/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../gcc-7-20161113/libsanitizer/sanitizer_common -I.. -I ../../../../gcc-7-20161113/libsanitizer/include -isystem ../../../../gcc-7-20161113/libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-apple-darwin15.6.0 -I../../../../gcc-7-20161113/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -g -O2 -MT sanitizer_mac.lo -MD -MP -MF .deps/sanitizer_mac.Tpo -c ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc -fno-common -DPIC -o .libs/sanitizer_mac.o ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Address Sanitizer reported a failure."); ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Undefined Behavior Sanitizer reported a failure."); ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Thread Sanitizer reported a failure."); ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Sanitizer tool reported a failure."); ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Consult syslog for more information."); ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] In file included from ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.h:56:47: error: attributes are not allowed on a function-definition _os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2))) ^~~~~~~~~~~~~ /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.h:715:109: error: ‘os_trace_payload_t’ has not been declared _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_ payload); ^~~~~~~~~~~~~~~~~ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc: In function ‘void __sanitizer::LogFullErrorReport(const char*)’: ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Address Sanitizer reported a failure."); ^ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: warning: passing NULL to non-pointer argument 6 of ‘void _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, int)’ [-Wconversion-null] os_trace("Address Sanitizer reported a failure."); ^~~~~~~~ In file included from ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Undefined Behavior Sanitizer reported a failure."); ^ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: warning: passing NULL to non-pointer argument 6 of ‘void _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, int)’ [-Wconversion-null] os_trace("Undefined Behavior Sanitizer reported a failure."); ^~~~~~~~ In file included from ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Thread Sanitizer reported a failure."); ^ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: warning: passing NULL to non-pointer argument 6 of ‘void _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, int)’ [-Wconversion-null] os_trace("Thread Sanitizer reported a failure."); ^~~~~~~~ In file included from ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Sanitizer tool reported a failure."); ^ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: warning: passing NULL to non-pointer argument 6 of ‘void _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, int)’ [-Wconversion-null] os_trace("Sanitizer tool reported a failure."); ^~~~~~~~ In file included from ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Consult syslog for more information."); ^ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: warning: passing NULL to non-pointer argument 6 of ‘void _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, int)’ [-Wconversion-null] os_trace("Consult syslog for more information."); ^~~~~~~~ make[4]: *** [sanitizer_mac.lo] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-target-libsanitizer] Error 2 make: *** [all] Error 2 > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) [not found] ` <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com> 2016-11-13 18:24 ` Fwd: " Jack Howarth @ 2016-11-14 14:11 ` Rainer Orth 2016-11-14 18:56 ` Jack Howarth [not found] ` <CAJMcOU8m_8oCKpV4RD=1wo=PEs9fBcP52gyD1wtsO4B1v85dfQ@mail.gmail.com> 2 siblings, 1 reply; 19+ messages in thread From: Rainer Orth @ 2016-11-14 14:11 UTC (permalink / raw) To: Jack Howarth; +Cc: GCC Patches, Bruce Korb [-- Attachment #1: Type: text/plain, Size: 1842 bytes --] Hi Jack, > > On darwin15, the proposed patch is insufficient to restore the bootstrap > > (after running genfixes in the fixincludes directory) unless I also apply > > the previously proposed change... > > no wonder: it's only been tested on darwin16. Care to explain what > error you're seeing? > > The failure that I see on darwin15 using your proposed patches and executing > genfixes in fixincludes before the build is... the actual errors are ... > In file included from > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: > /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.h:56:47: > error: attributes are not allowed on a function-definition > _os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2))) > ^~~~~~~~~~~~~ I've added a new fix to just remove that attribute. One could try and add a declaration with the attribute if need be, but I've avoid that trouble for now. > /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.h:715:109: > error: ‘os_trace_payload_t’ has not been declared > _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void > *buffer, size_t buffer_size, os_trace_payload_ payload); > ^~~~~~~~~~~~~~~~~ This one isn't caught so far because 10.11 has __OSX_AVAILABLE(10.10) __IOS_AVAILABLE(8.0) __WATCHOS_AVAILABLE(1.0) __TVOS_AVAILABLE(9.0) instead of __API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) I've updated the corresponding fix to deal with this variation and augmented the testcase accordingly. Hopefully the new patch works for you. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: macos-fixincludes-AvailabilityInternal.patch --] [-- Type: text/x-patch, Size: 5632 bytes --] # HG changeset patch # Parent c9e06f02a0d86f769e4c4720ddfc0938c76bcb20 Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1338,6 +1338,32 @@ fix = { }; /* + * macOS 10.12 <AvailabilityInternal.h> uses __attribute__((availability)) + * unconditionally. + */ +fix = { + hackname = darwin_availabilityinternal; + mach = "*-*-darwin*"; + files = AvailabilityInternal.h; + select = "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*"; + c_fix = format; + c_fix_arg = <<- _EOFix_ + #if defined(__has_attribute) + #if __has_attribute(availability) + %0 + #else + #define %1 + #endif + #else + #define %1 + #endif + _EOFix_; + + test_text = "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n" + "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))"; +}; + +/* * For the AAB_darwin7_9_long_double_funcs fix to be useful, * you have to not use "" includes. */ @@ -1410,6 +1436,62 @@ fix = { }; /* + * Mac OS X 10.11 <os/trace.h> uses attribute on function definition. + */ +fix = { + hackname = darwin_os_trace_1; + mach = "*-*-darwin*"; + files = os/trace.h; + select = "^(_os_trace_verify_printf.*) (__attribute__.*)"; + c_fix = format; + c_fix_arg = "%1"; + test_text = "_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2)))"; +}; + +/* + * Mac OS X 10.1[012] <os/trace.h> os_trace_payload_t typedef uses Blocks + * extension without guard. + */ +fix = { + hackname = darwin_os_trace_2; + mach = "*-*-darwin*"; + files = os/trace.h; + select = "typedef.*\\^os_trace_payload_t.*"; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);"; +}; + +/* + * In Mac OS X 10.1[012] <os/trace.h>, need to guard users of + * os_trace_payload_t typedef, too. + */ +fix = { + hackname = darwin_os_trace_3; + mach = "*-*-darwin*"; + files = os/trace.h; + select = <<- _EOSelect_ + __(API|OSX)_.* + OS_EXPORT.* + .* + _os_trace.*os_trace_payload_t payload); + _EOSelect_; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- _EOText_ + __API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) + OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED + void + _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); + + __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) + OS_EXPORT OS_NOTHROW + void + _os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload); + _EOText_; +}; + +/* * __private_extern__ doesn't exist in FSF GCC. Even if it did, * why would you ever put it in a system header file? */ @@ -2638,7 +2720,6 @@ fix = { c-fix-arg = "# define UINT_%164_MAX __UINT64_MAX__"; test-text = "# define UINT_FAST64_MAX ULLONG_MAX\n" "# define UINT_LEAST64_MAX ULLONG_MAX\n"; - _EOFix_; }; /* diff --git a/fixincludes/tests/base/AvailabilityInternal.h b/fixincludes/tests/base/AvailabilityInternal.h new file mode 100644 --- /dev/null +++ b/fixincludes/tests/base/AvailabilityInternal.h @@ -0,0 +1,31 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/AvailabilityInternal.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_AVAILABILITYINTERNAL_CHECK ) +#if defined(__has_attribute) + #if __has_attribute(availability) +#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x))) + #else + #define __API_A(x) + #endif +#else + #define __API_A(x) +#endif +#if defined(__has_attribute) + #if __has_attribute(availability) +#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))) + #else + #define __API_D(msg,x) + #endif +#else + #define __API_D(msg,x) +#endif +#endif /* DARWIN_AVAILABILITYINTERNAL_CHECK */ diff --git a/fixincludes/tests/base/os/trace.h b/fixincludes/tests/base/os/trace.h new file mode 100644 --- /dev/null +++ b/fixincludes/tests/base/os/trace.h @@ -0,0 +1,38 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/trace.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OS_TRACE_1_CHECK ) +_os_trace_verify_printf(const char *msg, ...) +#endif /* DARWIN_OS_TRACE_1_CHECK */ + + +#if defined( DARWIN_OS_TRACE_2_CHECK ) +#if __BLOCKS__ +typedef void (^os_trace_payload_t)(xpc_object_t xdict); +#endif +#endif /* DARWIN_OS_TRACE_2_CHECK */ + + +#if defined( DARWIN_OS_TRACE_3_CHECK ) +#if __BLOCKS__ +__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) +OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED +void +_os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); +#endif + +#if __BLOCKS__ +__OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) +OS_EXPORT OS_NOTHROW +void +_os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload); +#endif +#endif /* DARWIN_OS_TRACE_3_CHECK */ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) 2016-11-14 14:11 ` Rainer Orth @ 2016-11-14 18:56 ` Jack Howarth 0 siblings, 0 replies; 19+ messages in thread From: Jack Howarth @ 2016-11-14 18:56 UTC (permalink / raw) To: Rainer Orth; +Cc: GCC Patches, Bruce Korb Rainer, Unfortunately this permutation still fails to bootstrap on darwin15... libtool: compile: /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/./gcc/xgcc -shared-libgcc -B/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/./gcc -nostdinc++ -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/src -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/libsupc++/.libs -B/sw/lib/gcc7/x86_64-apple-darwin15.6.0/bin/ -B/sw/lib/gcc7/x86_64-apple-darwin15.6.0/lib/ -isystem /sw/lib/gcc7/x86_64-apple-darwin15.6.0/include -isystem /sw/lib/gcc7/x86_64-apple-darwin15.6.0/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../gcc-7-20161114/libsanitizer/sanitizer_common -I.. -I ../../../../gcc-7-20161114/libsanitizer/include -isystem ../../../../gcc-7-20161114/libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-apple-darwin15.6.0 -I../../../../gcc-7-20161114/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -g -O2 -MT sanitizer_mac.lo -MD -MP -MF .deps/sanitizer_mac.Tpo -c ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc -fno-common -DPIC -o .libs/sanitizer_mac.o ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Address Sanitizer reported a failure."); ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Undefined Behavior Sanitizer reported a failure."); ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Thread Sanitizer reported a failure."); ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Sanitizer tool reported a failure."); ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] os_trace("Consult syslog for more information."); ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] In file included from ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc: In function ‘void __sanitizer::LogFullErrorReport(const char*)’: ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Address Sanitizer reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: error: ‘_os_trace_with_buffer’ was not declared in this scope os_trace("Address Sanitizer reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:7: note: suggested alternative: ‘os_trace_with_payload’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Undefined Behavior Sanitizer reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: error: ‘_os_trace_with_buffer’ was not declared in this scope os_trace("Undefined Behavior Sanitizer reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:500:7: note: suggested alternative: ‘os_trace_with_payload’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Thread Sanitizer reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: error: ‘_os_trace_with_buffer’ was not declared in this scope os_trace("Thread Sanitizer reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:503:7: note: suggested alternative: ‘os_trace_with_payload’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Sanitizer tool reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: error: ‘_os_trace_with_buffer’ was not declared in this scope os_trace("Sanitizer tool reported a failure."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:505:7: note: suggested alternative: ‘os_trace_with_payload’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: error: ‘_Static_assert’ was not declared in this scope os_trace("Consult syslog for more information."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: note: suggested alternative: ‘__cpp_static_assert’ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: error: ‘_os_trace_with_buffer’ was not declared in this scope os_trace("Consult syslog for more information."); ^ ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:508:7: note: suggested alternative: ‘os_trace_with_payload’ make[4]: *** [sanitizer_mac.lo] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-target-libsanitizer] Error 2 make: *** [all] Error 2 Jack On Mon, Nov 14, 2016 at 9:11 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote: > Hi Jack, > >> > On darwin15, the proposed patch is insufficient to restore the bootstrap >> > (after running genfixes in the fixincludes directory) unless I also apply >> > the previously proposed change... >> >> no wonder: it's only been tested on darwin16. Care to explain what >> error you're seeing? >> >> The failure that I see on darwin15 using your proposed patches and executing >> genfixes in fixincludes before the build is... > > the actual errors are ... > >> In file included from >> ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: >> /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.h:56:47: >> error: attributes are not allowed on a function-definition >> _os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2))) >> ^~~~~~~~~~~~~ > > I've added a new fix to just remove that attribute. One could try and > add a declaration with the attribute if need be, but I've avoid that > trouble for now. > >> /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.h:715:109: >> error: ‘os_trace_payload_t’ has not been declared >> _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void >> *buffer, size_t buffer_size, os_trace_payload_ payload); >> ^~~~~~~~~~~~~~~~~ > > This one isn't caught so far because 10.11 has > > __OSX_AVAILABLE(10.10) __IOS_AVAILABLE(8.0) __WATCHOS_AVAILABLE(1.0) __TVOS_AVAILABLE(9.0) > > instead of > > __API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) > > I've updated the corresponding fix to deal with this variation and > augmented the testcase accordingly. > > Hopefully the new patch works for you. > > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University > > ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <CAJMcOU8m_8oCKpV4RD=1wo=PEs9fBcP52gyD1wtsO4B1v85dfQ@mail.gmail.com>]
[parent not found: <5829b908.03a3620a.24461.716eSMTPIN_ADDED_MISSING@mx.google.com>]
* Fwd: failure notice [not found] ` <5829b908.03a3620a.24461.716eSMTPIN_ADDED_MISSING@mx.google.com> @ 2016-11-14 13:19 ` Jack Howarth 0 siblings, 0 replies; 19+ messages in thread From: Jack Howarth @ 2016-11-14 13:19 UTC (permalink / raw) To: GCC Patches [-- Attachment #1: Type: text/plain, Size: 14839 bytes --] ---------- Forwarded message ---------- From: <MAILER-DAEMON@sourceware.org> Date: Mon, Nov 14, 2016 at 8:15 AM Subject: failure notice To: howarth.at.gcc@gmail.com Hi. This is the qmail-send program at sourceware.org. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. <gcc-patches@gcc.gnu.org>: Invalid mime type "text/html" detected in message text or attachment. Please send plain text messages only. See http://sourceware.org/lists.html#sourceware-list-info for more information. Contact gcc-patches-owner@gcc.gnu.org if you have questions about this. (#5.7.2) --- Below this line is a copy of the message. Return-Path: <howarth.at.gcc@gmail.com> Received: (qmail 26838 invoked by uid 89); 14 Nov 2016 13:15:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-Flag: YES X-Spam-SWARE-Status: Yes, score=5.5 required=5.0 tests=BAYES_40,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Care, 73, 27336, 7.3 X-Spam-Status: Yes, score=5.5 required=5.0 tests=BAYES_40,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: ***** X-HELO: mail-yw0-f182.google.com Received: from mail-yw0-f182.google.com (HELO mail-yw0-f182.google.com) (209.85.161.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Nov 2016 13:15:39 +0000 Received: by mail-yw0-f182.google.com with SMTP id a10so57164557ywa.3 for <gcc-patches@gcc.gnu.org>; Mon, 14 Nov 2016 05:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ut9+GijOTPsFgXgpyv5pRUOLVxPD0mjqwq3dgw9nVcc=; b=rnq9uE6RoNcPx/romZSBYrNuw2Z+26adCJWz2sZ+CBzYASOPPo+78xPFGbZcyCbVdb kDyv78RNQk33JxySlxjEmg8y6Bz0dB/QJlfrHf1VtGloVAbTpVuIsYS7ouZbJx3PZq9F lUyDBT0wUzNethLJaSKUaGVCYUetgurAyI6XB0T9CeiKM5qTv+ih/EM7Nr19v1zS1Hpz 8sndaqnzhh7ySKfWyB/AwhBrae1By/Iui55/pSwpoMFY2HP0ZmLEJ0Iahz2dGerVhtcr hKzYP38ysWs16ACgxYO7Ro8CKG465Z9Er7Q2jNHvgimz3jsoI7/KtIVCptRn5nTDotDU 2CNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ut9+GijOTPsFgXgpyv5pRUOLVxPD0mjqwq3dgw9nVcc=; b=jjWHtYqA+8b7cqwAbEKsfErUsvN6OoBdn46xqgDyxI18HReNt/iFa2GZbyhDcg2Ao3 //e4mfm/CSHAfi0yUTkxuYk7h1GVodTbfFZD7ifx00zy9AbB0F0+EVf+fOJAhNOhzBRl QwGyokx7YSxoJybduyTr8TEvRZQCRfI2joVCbmj5SxqFiLT0O6PgrvIGwAr3ofIQvpPy 9AylyMxG4C9g8V+/w98kTYx/vtsAefnXFntyjoUjkX9Irub7yVyDI6DP3CmaKOVJXjJ0 jpY+SaBYzQxuKP8CY5K+tLdUWPOew8s/Yt0iPTX3Yc9ci7qeklHCdvnFD2/V2QnHltCW C9zg== X-Gm-Message-State: ABUngvfUQDaYa/k+Z0TyCk8hv9XVzgk7w8548KL3RmaaLIB4I+909ZmhJFsXKI/GVQASQUlEbGTOs1KHYaaxtQ== X-Received: by 10.202.245.74 with SMTP id t71mr8074538oih.37.1479129337927; Mon, 14 Nov 2016 05:15:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.225.212 with HTTP; Mon, 14 Nov 2016 05:15:36 -0800 (PST) In-Reply-To: <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com> References: <ydd7f8awce3.fsf@CeBiTec.Uni-Bielefeld.DE> <CAJMcOU-k7qAJC9qpPo1ybTjWpsP7aEQGgZLwaOWomoVqMyMn8A@mail.gmail.com> <ydd37ivr6qp.fsf@CeBiTec.Uni-Bielefeld.DE> <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com> From: Jack Howarth <howarth.at.gcc@gmail.com> Date: Mon, 14 Nov 2016 08:15:36 -0500 Message-ID: <CAJMcOU8m_8oCKpV4RD=1wo=PEs9fBcP52gyD1wtsO4B1v85dfQ@mail.gmail.com> Subject: Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) To: Rainer Orth <ro@cebitec.uni-bielefeld.de> Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Bruce Korb <bkorb@gnu.org> Content-Type: multipart/mixed; boundary=001a113d2bf2c3bb0e054142a2bd --001a113d2bf2c3bb0e054142a2bd Content-Type: multipart/alternative; boundary=001a113d2bf2c3bb08054142a2bb --001a113d2bf2c3bb08054142a2bb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Rainer, In case it helps, attached is a diff of the os/trace.h header from OS X 11.11 vs that from MacOS X 11.12. It looks like the context of the changes that you are trying to apply into are different between the two OS releases and are the cause of the build failures on darwin15. Jack On Sun, Nov 13, 2016 at 1:19 PM, Jack Howarth <howarth.at.gcc@gmail.com> wrote: > > > On Sun, Nov 13, 2016 at 5:53 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de= > > wrote: > >> Hi Jack, >> >> > On darwin15, the proposed patch is insufficient to restore the bootstr= ap >> > (after running genfixes in the fixincludes directory) unless I also >> apply >> > the previously proposed change... >> >> no wonder: it's only been tested on darwin16. Care to explain what >> error you're seeing? >> >> > The failure that I see on darwin15 using your proposed patches and > executing genfixes in fixincludes before the build is... > > libtool: compile: /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/./gcc/xg= cc > -shared-libgcc -B/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/./gcc > -nostdinc++ -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64- > apple-darwin15.6.0/libstdc++-v3/src -L/sw/src/fink.build/gcc7-7.0. > 0-1/darwin_objdir/x86_64-apple-darwin15.6.0/libstdc++-v3/src/.libs > -L/sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/x86_64- > apple-darwin15.6.0/libstdc++-v3/libsupc++/.libs > -B/sw/lib/gcc7/x86_64-apple-darwin15.6.0/bin/ -B/sw/lib/gcc7/x86_64-apple= -darwin15.6.0/lib/ > -isystem /sw/lib/gcc7/x86_64-apple-darwin15.6.0/include -isystem > /sw/lib/gcc7/x86_64-apple-darwin15.6.0/sys-include -D_GNU_SOURCE -D_DEBUG > -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS > -DHAVE_RPC_XDR_H=3D0 -DHAVE_TIRPC_RPC_XDR_H=3D0 -I. > -I../../../../gcc-7-20161113/libsanitizer/sanitizer_common -I.. -I > ../../../../gcc-7-20161113/libsanitizer/include -isystem > ../../../../gcc-7-20161113/libsanitizer/include/system -Wall -W > -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC > -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tabl= es > -fvisibility=3Dhidden -Wno-variadic-macros -I../../libstdc++-v3/include > -I../../libstdc++-v3/include/x86_64-apple-darwin15.6.0 > -I../../../../gcc-7-20161113/libsanitizer/../libstdc++-v3/libsupc++ > -std=3Dgnu++11 -g -O2 -MT sanitizer_mac.lo -MD -MP -MF > .deps/sanitizer_mac.Tpo -c ../../../../gcc-7-20161113/ > libsanitizer/sanitizer_common/sanitizer_mac.cc -fno-common -DPIC -o > .libs/sanitizer_mac.o > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :497:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > os_trace("Address Sanitizer reported a failure."); > > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :497:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :497:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :500:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > os_trace("Undefined Behavior Sanitizer reported a failure."); > > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :500:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :500:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :503:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > os_trace("Thread Sanitizer reported a failure."); > > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :503:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :503:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :505:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > os_trace("Sanitizer tool reported a failure."); > > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :505:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :505:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :508:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > os_trace("Consult syslog for more information."); > > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :508:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :508:0: > warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] > In file included from ../../../../gcc-7-20161113/ > libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: > /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.= h:56:47: > error: attributes are not allowed on a function-definition > _os_trace_verify_printf(const char *msg, ...) > __attribute__((format(printf, 1, 2))) > ^~~~~~~~~~~~~ > /sw/src/fink.build/gcc7-7.0.0-1/darwin_objdir/gcc/include-fixed/os/trace.= h:715:109: > error: =E2=80=98os_trace_payload_t=E2=80=99 has not been declared > _os_trace_with_buffer(void *dso, const char *message, uint8_t type, cons= t > void *buffer, size_t buffer_size, os_trace_payload_ payload); > > ^~~~~~~~~~~~~~~~~ > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= : > In function =E2=80=98void __sanitizer::LogFullErrorReport(const char*)=E2= =80=99: > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :497:7: > error: =E2=80=98_Static_assert=E2=80=99 was not declared in this scope > os_trace("Address Sanitizer reported a failure."); > ^ > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :497:7: > note: suggested alternative: =E2=80=98__cpp_static_assert=E2=80=99 > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :497:7: > warning: passing NULL to non-pointer argument 6 of =E2=80=98void > _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, > int)=E2=80=99 [-Wconversion-null] > os_trace("Address Sanitizer reported a failure."); > ^~~~~~~~ > In file included from ../../../../gcc-7-20161113/ > libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :500:7: > error: =E2=80=98_Static_assert=E2=80=99 was not declared in this scope > os_trace("Undefined Behavior Sanitizer reported a failure."); > ^ > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :500:7: > note: suggested alternative: =E2=80=98__cpp_static_assert=E2=80=99 > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :500:7: > warning: passing NULL to non-pointer argument 6 of =E2=80=98void > _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, > int)=E2=80=99 [-Wconversion-null] > os_trace("Undefined Behavior Sanitizer reported a failure."); > ^~~~~~~~ > In file included from ../../../../gcc-7-20161113/ > libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :503:7: > error: =E2=80=98_Static_assert=E2=80=99 was not declared in this scope > os_trace("Thread Sanitizer reported a failure."); > ^ > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :503:7: > note: suggested alternative: =E2=80=98__cpp_static_assert=E2=80=99 > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :503:7: > warning: passing NULL to non-pointer argument 6 of =E2=80=98void > _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, > int)=E2=80=99 [-Wconversion-null] > os_trace("Thread Sanitizer reported a failure."); > ^~~~~~~~ > In file included from ../../../../gcc-7-20161113/ > libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :505:7: > error: =E2=80=98_Static_assert=E2=80=99 was not declared in this scope > os_trace("Sanitizer tool reported a failure."); > ^ > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :505:7: > note: suggested alternative: =E2=80=98__cpp_static_assert=E2=80=99 > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :505:7: > warning: passing NULL to non-pointer argument 6 of =E2=80=98void > _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, > int)=E2=80=99 [-Wconversion-null] > os_trace("Sanitizer tool reported a failure."); > ^~~~~~~~ > In file included from ../../../../gcc-7-20161113/ > libsanitizer/sanitizer_common/sanitizer_mac.cc:39:0: > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :508:7: > error: =E2=80=98_Static_assert=E2=80=99 was not declared in this scope > os_trace("Consult syslog for more information."); > ^ > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :508:7: > note: suggested alternative: =E2=80=98__cpp_static_assert=E2=80=99 > ../../../../gcc-7-20161113/libsanitizer/sanitizer_common/sanitizer_mac.cc= :508:7: > warning: passing NULL to non-pointer argument 6 of =E2=80=98void > _os_trace_with_buffer(void*, const char*, uint8_t, const void*, size_t, > int)=E2=80=99 [-Wconversion-null] > os_trace("Consult syslog for more information."); > ^~~~~~~~ > make[4]: *** [sanitizer_mac.lo] Error 1 > make[3]: *** [all-recursive] Error 1 > make[2]: *** [all] Error 2 > make[1]: *** [all-target-libsanitizer] Error 2 > make: *** [all] Error 2 > > > Rainer >> >> -- >> ------------------------------------------------------------ >> ----------------- >> Rainer Orth, Center for Biotechnology, Bielefeld University >> > > [-- Attachment #2: trace_header_darwin15_vs_darwin16.diff --] [-- Type: text/plain, Size: 30589 bytes --] --- /usr/include/os/trace.h 2016-02-27 01:01:41.000000000 -0500 +++ trace.h 2016-10-24 00:19:18.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015 Apple Inc. All rights reserved. + * Copyright (c) 2013-2016 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -30,6 +30,7 @@ #include <stdint.h> #include <stdbool.h> #include <stdarg.h> +#include <mach-o/loader.h> #if __has_include(<xpc/xpc.h>) #include <xpc/xpc.h> #else @@ -40,395 +41,86 @@ #error "must be GNU C compatible" #endif -extern void *__dso_handle; +__BEGIN_DECLS -OS_ALWAYS_INLINE -static inline void -_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2))) -{ -#pragma unused(msg) -} +extern struct mach_header __dso_handle; #if !defined OS_COUNT_ARGS #define OS_COUNT_ARGS(...) OS_COUNT_ARGS1(, ##__VA_ARGS__, _8, _7, _6, _5, _4, _3, _2, _1, _0) #define OS_COUNT_ARGS1(z, a, b, c, d, e, f, g, h, cnt, ...) cnt #endif -#define _os_trace_0(_l, _m, _t) __extension__({ \ - _os_trace_verify_printf(_l); \ - _os_trace_with_buffer(&__dso_handle, _m, _t, NULL, 0, NULL); \ - __asm__(""); /* avoid tailcall */ \ -}) - -#define _os_trace_1(_l, _m, _t, _1) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - _os_trace_verify_printf(_l, _c1); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - unsigned char _s[2]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._s[1] = 1, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_2(_l, _m, _t, _1, _2) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - _os_trace_verify_printf(_l, _c1, _c2); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - unsigned char _s[3]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._s[2] = 2, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_3(_l, _m, _t, _1, _2, _3) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - unsigned char _s[4]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._s[3] = 3, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_4(_l, _m, _t, _1, _2, _3, _4) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - unsigned char _s[5]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._s[4] = 4, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_5(_l, _m, _t, _1, _2, _3, _4, _5) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - const __typeof__(_5) _c5 = _5; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4, _c5); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - __typeof__(_c5) _f5; \ - unsigned char _s[6]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._f5 = _c5, ._s[4] = sizeof(_c5), \ - ._s[5] = 5, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_6(_l, _m, _t, _1, _2, _3, _4, _5, _6) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - const __typeof__(_5) _c5 = _5; \ - const __typeof__(_6) _c6 = _6; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4, _c5, _c6); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - __typeof__(_c5) _f5; \ - __typeof__(_c6) _f6; \ - unsigned char _s[7]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._f5 = _c5, ._s[4] = sizeof(_c5), \ - ._f6 = _c6, ._s[5] = sizeof(_c6), \ - ._s[6] = 6, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_7(_l, _m, _t, _1, _2, _3, _4, _5, _6, _7) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - const __typeof__(_5) _c5 = _5; \ - const __typeof__(_6) _c6 = _6; \ - const __typeof__(_7) _c7 = _7; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4, _c5, _c6, _c7); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - __typeof__(_c5) _f5; \ - __typeof__(_c6) _f6; \ - __typeof__(_c7) _f7; \ - unsigned char _s[8]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._f5 = _c5, ._s[4] = sizeof(_c5), \ - ._f6 = _c6, ._s[5] = sizeof(_c6), \ - ._f7 = _c7, ._s[6] = sizeof(_c7), \ - ._s[7] = 7, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), NULL); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_with_payload_1(_l, _m, _t, _payload) __extension__({ \ - _os_trace_verify_printf(_l); \ - _os_trace_with_buffer(&__dso_handle, _m, _t, NULL, 0, _payload); \ - __asm__(""); /* avoid tailcall */ \ -}) - -#define _os_trace_with_payload_2(_l, _m, _t, _1, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - _os_trace_verify_printf(_l, _c1); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - unsigned char _s[2]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._s[1] = 1, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) - -#define _os_trace_with_payload_3(_l, _m, _t, _1, _2, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - _os_trace_verify_printf(_l, _c1, _c2); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - unsigned char _s[3]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._s[2] = 2, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) +static inline void +_os_trace_verify_printf(const char *msg, ...) __attribute__((format(os_trace, 1, 2))); -#define _os_trace_with_payload_4(_l, _m, _t, _1, _2, _3, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - unsigned char _s[4]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._s[3] = 3, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) +OS_ALWAYS_INLINE +static inline void +_os_trace_verify_printf(const char *msg, ...) +{ +#pragma unused(msg) +} -#define _os_trace_with_payload_5(_l, _m, _t, _1, _2, _3, _4, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - unsigned char _s[5]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._s[4] = 4, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) +/* We need at least clang 7.3 or later due to bugs in os_log_format parsing */ +#if __has_builtin(__builtin_os_log_format) && (__clang_major__ > 7 || (__clang_major__ == 7 && __clang_minor__ >= 3)) -#define _os_trace_with_payload_6(_l, _m, _t, _1, _2, _3, _4, _5, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - const __typeof__(_4) _c5 = _5; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4, _c5); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - __typeof__(_c5) _f5; \ - unsigned char _s[6]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._f5 = _c5, ._s[4] = sizeof(_c5), \ - ._s[5] = 5, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ +/* Previous OSes must go through older style... + * + * Format: + * Items: [ ] + * Item sizes: [ + * 8 bits * count + * ] + * Item count: 8 bits + */ + +#define OS_TRACE_CALL(_t, _p, _f, ...) __extension__({ \ + if (os_trace_type_enabled(_t)) { \ + _os_trace_verify_printf(_f, ##__VA_ARGS__); \ + __attribute__((section("__TEXT,__oslogstring,cstring_literals"),internal_linkage)) static const char __f[] __asm(OS_STRINGIFY(OS_CONCAT(LOSTRACE_, __COUNTER__))) = _f; \ + unsigned int __size = (unsigned int) __builtin_os_log_format_buffer_size(_f, ##__VA_ARGS__); \ + uint8_t _buf[__size]; \ + __builtin_os_log_format(_buf, _f, ##__VA_ARGS__); \ + unsigned int tz = 0; \ + uint8_t tb[__size]; \ + uint8_t *buff = _buf; \ + uint8_t *p = ++buff; \ + uint8_t count = *p++; \ + uint8_t trailer[count + 1]; \ + trailer[count] = count; \ + for (uint8_t ii = 0; ii < count; ii++) { \ + uint8_t desc = *p++; \ + uint8_t size = *p++; \ + uint8_t *value = p; \ + p += size; \ + if ((desc >> 4) || (desc & 0x1)) { \ + size = 0;\ + }\ + if (size) {\ + memcpy(&tb[tz], value, size);\ + tz += size;\ + }\ + trailer[ii] = size;\ + }\ + memcpy(&tb[tz], trailer, sizeof(trailer));\ + tz += sizeof(trailer);\ + _os_trace_with_buffer(&__dso_handle, __f, _t, tb, tz, _p);\ + } \ }) +#else +#define OS_TRACE_CALL(...) +#endif -#define _os_trace_with_payload_7(_l, _m, _t, _1, _2, _3, _4, _5, _6, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - const __typeof__(_5) _c5 = _5; \ - const __typeof__(_6) _c6 = _6; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4, _c5, _c6); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - __typeof__(_c5) _f5; \ - __typeof__(_c6) _f6; \ - unsigned char _s[7]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._f5 = _c5, ._s[4] = sizeof(_c5), \ - ._f6 = _c6, ._s[5] = sizeof(_c6), \ - ._s[6] = 6, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) +// macros to re-order arguments so we can call log function +#define _os_trace_with_payload_1(_t, _f, _p) OS_TRACE_CALL(_t, _p, _f) +#define _os_trace_with_payload_2(_t, _f, _1, _p) OS_TRACE_CALL(_t, _p, _f, _1) +#define _os_trace_with_payload_3(_t, _f, _1, _2, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2) +#define _os_trace_with_payload_4(_t, _f, _1, _2, _3, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3) +#define _os_trace_with_payload_5(_t, _f, _1, _2, _3, _4, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4) +#define _os_trace_with_payload_6(_t, _f, _1, _2, _3, _4, _5, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4, _5) +#define _os_trace_with_payload_7(_t, _f, _1, _2, _3, _4, _5, _6, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4, _5, _6) +#define _os_trace_with_payload_8(_t, _f, _1, _2, _3, _4, _5, _6, _7, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4, _5, _6, _7) -#define _os_trace_with_payload_8(_l, _m, _t, _1, _2, _3, _4, _5, _6, _7, _payload) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wpacked\"") \ - const __typeof__(_1) _c1 = _1; \ - const __typeof__(_2) _c2 = _2; \ - const __typeof__(_3) _c3 = _3; \ - const __typeof__(_4) _c4 = _4; \ - const __typeof__(_5) _c5 = _5; \ - const __typeof__(_6) _c6 = _6; \ - const __typeof__(_7) _c7 = _7; \ - _os_trace_verify_printf(_l, _c1, _c2, _c3, _c4, _c5, _c6, _c7); \ - const struct __attribute__((packed)) { \ - __typeof__(_c1) _f1; \ - __typeof__(_c2) _f2; \ - __typeof__(_c3) _f3; \ - __typeof__(_c4) _f4; \ - __typeof__(_c5) _f5; \ - __typeof__(_c6) _f6; \ - __typeof__(_c7) _f7; \ - unsigned char _s[8]; \ - } _buf = { \ - ._f1 = _c1, ._s[0] = sizeof(_c1), \ - ._f2 = _c2, ._s[1] = sizeof(_c2), \ - ._f3 = _c3, ._s[2] = sizeof(_c3), \ - ._f4 = _c4, ._s[3] = sizeof(_c4), \ - ._f5 = _c5, ._s[4] = sizeof(_c5), \ - ._f6 = _c6, ._s[5] = sizeof(_c6), \ - ._f7 = _c7, ._s[6] = sizeof(_c7), \ - ._s[7] = 7, \ - }; \ - _os_trace_with_buffer(&__dso_handle, _m, _t, &_buf, sizeof(_buf), _payload); \ - __asm__(""); /* avoid tailcall */ \ - _Pragma("clang diagnostic pop") \ -}) +#define _os_trace_call_n(_t, _f, ...) OS_TRACE_CALL(_t, NULL, _f, ##__VA_ARGS__) /*! * @@ -466,7 +158,7 @@ /*! * @define OS_TRACE_TYPE_RELEASE - * Trace messages to be recorded on a typical user install. These should be + * Trace messages to be captured on a typical user install. These should be * limited to things which improve diagnosis of a failure/crash/hang. Trace * buffers are generally smaller on a production system. */ @@ -474,12 +166,19 @@ /*! * @define OS_TRACE_TYPE_DEBUG - * Trace messages to be recorded while debugger or other development tool is + * Trace messages to be captured while debugger or other development tool is * attached to the originator. */ #define OS_TRACE_TYPE_DEBUG (1u << 1) /*! + * @define OS_TRACE_TYPE_INFO + * Trace messages that are captured when a debugger is attached, system or + * Application mode has been increased to include additional information. + */ +#define OS_TRACE_TYPE_INFO (1u << 2) + +/*! * @define OS_TRACE_TYPE_ERROR * Trace the message as an error and force a collection as a failure may be * imminent. @@ -493,8 +192,6 @@ */ #define OS_TRACE_TYPE_FAULT ((1u << 7) | (1u << 6) | (1u << 0)) -__BEGIN_DECLS - /*! * @typedef os_trace_payload_t * A block that populates an xpc_object_t of type XPC_TYPE_DICTIONARY to represent @@ -512,7 +209,7 @@ * @function os_trace * * @abstract - * Insert a trace message into a buffer pool for later decoding. + * Always inserts a trace message into a buffer pool for later decoding. * * @discussion * Trace message that will be recorded on a typical user install. These should @@ -525,25 +222,48 @@ * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * - * os_trace("network event: %ld, last seen: %ld, avg: %g", event_id, last_seen, avg); + * os_trace("network event: %ld, last seen: %ld, avg: %g", event_id, last_seen, avg); */ -#define os_trace(format, ...) __extension__({ \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"") \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_RELEASE, ##__VA_ARGS__); \ - _Pragma("clang diagnostic pop") \ -}) +#define os_trace(format, ...) OS_TRACE_CALL(OS_TRACE_TYPE_RELEASE, NULL, format, ##__VA_ARGS__) + +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0) \ + || (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0) \ + || (defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_10_0) \ + || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12) + +/*! + * @function os_trace_info + * + * @abstract + * Optionally inserts a trace message containing additional information into a + * buffer pool for later decoding. + * + * @discussion + * Trace messages that will be captured when additional information is needed + * and are not captured by default. They will only be captured if the + * system/process/activity mode has been increased or if a Development tool has + * been attached to the process. + * + * @param format + * A printf-style format string that represents a human-readable message when + * the trace line is decoded. Only scalar types are supported, attempts + * to pass arbitrary strings will store a pointer that is unresolvable and + * will generate an error during decode. + * + * os_trace_info("network interface status %ld", status); + */ +#define os_trace_info(format, ...) OS_TRACE_CALL(OS_TRACE_TYPE_INFO, NULL, format, ##__VA_ARGS__) + +#endif /*! * @function os_trace_debug * * @abstract - * Insert a trace message into a buffer pool for later decoding. + * Insert debug trace message into a buffer pool for later decoding. * * @discussion - * Trace message to be recorded while debugger or other development tool is + * Debug trace message to be recorded while debugger or other development tool is * attached to the originator. This is transported interprocess to help * diagnose the entire call chain including external helpers. * @@ -553,13 +273,36 @@ * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * - * os_trace_debug("network interface status %ld", status); + * os_trace_debug("network interface status %ld", status); */ -#define os_trace_debug(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace_dbg"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_DEBUG, ##__VA_ARGS__); \ -}) +#define os_trace_debug(format, ...) OS_TRACE_CALL(OS_TRACE_TYPE_DEBUG, NULL, format, ##__VA_ARGS__) + +/*! + * @function os_trace_info_enabled + * + * @abstract + * Avoid unnecessary work for a trace point by checking if additional information + * is enabled. + * + * @discussion + * Avoid unnecessary work for a trace point by checking if additional information + * is enabled. Generally trace points should not involve expensive operations, but some + * circumstances warrant it. Use this function to avoid doing the work unless + * debug level trace messages are requested. + * + * if (os_trace_info_enabled()) { + * os_trace_info("value = %d, average = %d", + * [[dict objectForKey: @"myKey"] intValue], + * (int) [self getAverage: dict]); + * } + * + * @result + * Returns true if info types are enabled. + */ +__API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) +OS_EXPORT OS_NOTHROW OS_WARN_RESULT +bool +os_trace_info_enabled(void); /*! * @function os_trace_debug_enabled @@ -582,12 +325,40 @@ * @result * Returns true if debug mode is enabled. */ -__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) +__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_trace_debug_enabled(void); /*! + * @function os_trace_type_enabled + * + * @abstract + * Avoid unnecessary work for a trace point by checking a specific type + * + * @discussion + * Avoid unnecessary work for a trace point by checking a specific type + * + * @result + * Returns true if type is enabled. + */ +__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) +OS_NOTHROW OS_WARN_RESULT OS_ALWAYS_INLINE +static inline bool +os_trace_type_enabled(uint8_t type) +{ + switch (type) { + case OS_TRACE_TYPE_INFO: + return os_trace_info_enabled(); + + case OS_TRACE_TYPE_DEBUG: + return os_trace_debug_enabled(); + } + + return true; +} + +/*! * @function os_trace_error * * @abstract @@ -604,13 +375,9 @@ * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * - * os_trace_error("socket %d connection timeout %ld", fd, secs); + * os_trace_error("socket %d connection timeout %ld", fd, secs); */ -#define os_trace_error(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_ERROR, ##__VA_ARGS__); \ -}) +#define os_trace_error(format, ...) OS_TRACE_CALL(OS_TRACE_TYPE_ERROR, NULL, format, ##__VA_ARGS__) /*! * @function os_trace_fault @@ -629,13 +396,9 @@ * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * - * os_trace_fault("failed to lookup uid %d - aborting", uid); + * os_trace_fault("failed to lookup uid %d - aborting", uid); */ -#define os_trace_fault(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_FAULT, ##__VA_ARGS__); \ -}) +#define os_trace_fault(format, ...) OS_TRACE_CALL(OS_TRACE_TYPE_FAULT, NULL, format, ##__VA_ARGS__) #if __has_include(<xpc/xpc.h>) /*! @@ -661,33 +424,43 @@ * * os_trace_with_payload("network event %ld", event, ^(xpc_object_t xdict) { * - * // validate the network interface and address where what was expected - * xpc_dictionary_set_string(xdict, "network", ifp->ifa_name); - * xpc_dictionary_set_string(xdict, "ip_address", _get_address(ifp)); + * // validate the network interface and address where what was expected + * xpc_dictionary_set_string(xdict, "network", ifp->ifa_name); + * xpc_dictionary_set_string(xdict, "ip_address", _get_address(ifp)); * }); */ -#define os_trace_with_payload(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_RELEASE, ##__VA_ARGS__); \ +#define os_trace_with_payload(format, ...) __extension__({ \ + OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(OS_TRACE_TYPE_RELEASE, format, ##__VA_ARGS__); \ +}) + +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0) \ + || (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0) \ + || (defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_10_0) \ + || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12) + +#define os_trace_info_with_payload(format, ...) __extension__({ \ + OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(OS_TRACE_TYPE_INFO, format, ##__VA_ARGS__); \ }) -#define os_trace_debug_with_payload(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace_dbg"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_DEBUG, ##__VA_ARGS__); \ +#else + +__API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) +OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED +void +os_trace_info_with_payload(const char *format, ...); + +#endif + +#define os_trace_debug_with_payload(format, ...) __extension__({ \ + OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(OS_TRACE_TYPE_DEBUG, format, ##__VA_ARGS__); \ }) -#define os_trace_error_with_payload(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_ERROR, ##__VA_ARGS__); \ +#define os_trace_error_with_payload(format, ...) __extension__({ \ + OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(OS_TRACE_TYPE_ERROR, format, ##__VA_ARGS__); \ }) -#define os_trace_fault_with_payload(format, ...) __extension__({ \ - _Static_assert(__builtin_constant_p(format), "format must be a constant string"); \ - __attribute__((section("__TEXT,__os_trace"))) static const char _m[] = format; \ - OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(format, _m, OS_TRACE_TYPE_FAULT, ##__VA_ARGS__); \ +#define os_trace_fault_with_payload(format, ...) __extension__({ \ + OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(OS_TRACE_TYPE_FAULT, format, ##__VA_ARGS__); \ }) #endif // __has_include(<xpc/xpc.h>) @@ -698,8 +471,8 @@ * @abstract * Internal function to support pre-encoded buffer. */ -__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) -OS_EXPORT OS_NOTHROW +__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) +OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) [not found] ` <CAJMcOU8m_8oCKpV4RD=1wo=PEs9fBcP52gyD1wtsO4B1v85dfQ@mail.gmail.com> [not found] ` <5829b908.03a3620a.24461.716eSMTPIN_ADDED_MISSING@mx.google.com> @ 2016-11-14 14:22 ` Rainer Orth 1 sibling, 0 replies; 19+ messages in thread From: Rainer Orth @ 2016-11-14 14:22 UTC (permalink / raw) To: Jack Howarth; +Cc: GCC Patches, Bruce Korb Hi Jack, > In case it helps, attached is a diff of the os/trace.h header from OS X 11.11 vs that > from MacOS X 11.12. It looks like the context of the changes that you are trying to > apply into are different between the two OS releases and are the cause of the build > failures on darwin15. as I wrote, there are two issues, one a slightly different context, the other a broken function definition (which is gone in Darwin 16), both of which should be fixed by my updated patch. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-11-21 9:55 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-11 10:15 [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) Rainer Orth 2016-11-11 11:19 ` Mike Stump 2016-11-11 16:17 ` Iain Sandoe 2016-11-11 16:50 ` Rainer Orth 2016-11-11 16:58 ` Iain Sandoe 2016-11-11 17:01 ` Rainer Orth 2016-11-11 21:25 ` Bruce Korb 2016-11-18 10:45 ` Rainer Orth 2016-11-18 17:23 ` Bruce Korb 2016-11-18 17:42 ` Mike Stump 2016-11-18 19:25 ` Bruce Korb 2016-11-21 9:55 ` Rainer Orth 2016-11-21 9:52 ` Rainer Orth [not found] ` <CAJMcOU-k7qAJC9qpPo1ybTjWpsP7aEQGgZLwaOWomoVqMyMn8A@mail.gmail.com> 2016-11-13 10:53 ` Rainer Orth [not found] ` <CAJMcOU93wuAXjLz7fRR1vRmgXn-BU7ajcOafxUWRfd1Rs4jk5g@mail.gmail.com> 2016-11-13 18:24 ` Fwd: " Jack Howarth 2016-11-14 14:11 ` Rainer Orth 2016-11-14 18:56 ` Jack Howarth [not found] ` <CAJMcOU8m_8oCKpV4RD=1wo=PEs9fBcP52gyD1wtsO4B1v85dfQ@mail.gmail.com> [not found] ` <5829b908.03a3620a.24461.716eSMTPIN_ADDED_MISSING@mx.google.com> 2016-11-14 13:19 ` Fwd: failure notice Jack Howarth 2016-11-14 14:22 ` [fixincludes] Fix macOS 10.12 <AvailabilityInternal.h> and <os/trace.h> (PR sanitizer/78267) Rainer Orth
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).