From patchwork Mon Nov 14 14:11:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 694541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tHXWq0sSWz9s9c for ; Tue, 15 Nov 2016 01:11:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Oy47cXO/"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=R2wWY0/2UiNi7l3H BnlwiC08+4T54eVl5UmyPAdliUHcYUcl17Kt9yxl08sEZdK/S7aoXfK8DmX4kilf tzErWGEaDlm4kX0Cko5krk4agzh9Fgq2APtAQnKOi+q9J3XjmIm9E+2fbxBcZu8C Rdqw46uuTubNu4QRNUvwac093rQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=9LRmQU5Kbo9kFShYFtCBoT JT7pc=; b=Oy47cXO/on8BlAIDTMqRcReTr202W9TFG0whJ06s/YylJ3m2roAxmV jx0/ZNwIE0EbxKHpVxOKwoRi6AR0s54VKrW6oOIrLvMek3tRY/Jk+tvWB+mSIjBH PfRem4Bszmxme4YQri1ahlMlK67rrCASv3/LtfFW5gl/JiM43WgHg= Received: (qmail 113551 invoked by alias); 14 Nov 2016 14:11:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 113524 invoked by uid 89); 14 Nov 2016 14:11:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=8:ad, 8:os, 8:ce, 90 X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Nov 2016 14:11:34 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id C6B2D109; Mon, 14 Nov 2016 15:11:31 +0100 (CET) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id CM8CgVKZJEgq; Mon, 14 Nov 2016 15:11:27 +0100 (CET) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 353D0108; Mon, 14 Nov 2016 15:11:27 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id uAEEBPnU016411; Mon, 14 Nov 2016 15:11:25 +0100 (MET) From: Rainer Orth To: Jack Howarth Cc: GCC Patches , Bruce Korb Subject: Re: [fixincludes] Fix macOS 10.12 and (PR sanitizer/78267) References: Date: Mon, 14 Nov 2016 15:11:25 +0100 In-Reply-To: (Jack Howarth's message of "Sun, 13 Nov 2016 13:19:20 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 # HG changeset patch # Parent c9e06f02a0d86f769e4c4720ddfc0938c76bcb20 Fix macOS 10.12 and (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 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 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_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] , 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 */