From patchwork Fri Nov 11 10:15:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 81805 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1189459qge; Fri, 11 Nov 2016 02:16:10 -0800 (PST) X-Received: by 10.98.91.198 with SMTP id p189mr5600463pfb.22.1478859370373; Fri, 11 Nov 2016 02:16:10 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id we6si7905954pac.314.2016.11.11.02.16.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 02:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441059-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-441059-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441059-patch=linaro.org@gcc.gnu.org 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:date:message-id:mime-version:content-type; q=dns; s=default; b=d7eP4wVitokuuOOgbSp2ADcCUdTy6PH15apj72hmTp3DBA8r9f pLdhFxjkoabx0jkvIkGBgOfu8qZPmicKTrsAvYkMT+g4qmNBnjjYGpg0OfUjUjSg ORyoG6O4lqGFX8X5Oo3sZ1/Gv1WFauqdr78Kg60WfmZqE9HBF7Cya/Ejw= 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:date:message-id:mime-version:content-type; s= default; bh=Wh5b+qp5aU7XdX0h+fLBa858K0E=; b=oRy0aDl90q5nBv+5xOEN eF3KfTFLwRUR/S+1UDfhktF2fDf81fjhMujf8BML8Rv7BXQXf8G1iaFQHpafuwMU hVqwYDt7Q8RWcmU/OHlGTGY+ZxIOO+e8Z1WvpAKeYk1vxAFDJv5w1FEr4RvpRF1d KyD4yX9xnFi4W7ZJKw4jWBI= Received: (qmail 71022 invoked by alias); 11 Nov 2016 10:15:51 -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 71005 invoked by uid 89); 11 Nov 2016 10:15:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=EDIT, manufacturer, 8.0, ios 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; Fri, 11 Nov 2016 10:15:39 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 806EA41D; Fri, 11 Nov 2016 11:15:37 +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 I3im12l4Xgyl; Fri, 11 Nov 2016 11:15:33 +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 5212B41A; Fri, 11 Nov 2016 11:15:33 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id uABAFWN6014990; Fri, 11 Nov 2016 11:15:32 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Bruce Korb Subject: [fixincludes] Fix macOS 10.12 and (PR sanitizer/78267) Date: Fri, 11 Nov 2016 11:15:32 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Since the recent libsanitizer import, macOS 10.12 bootstrap is broken: * 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. * 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 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. # HG changeset patch # Parent 38420045cf6aa616f517ca5fcfd15f2b55e68cf0 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,44 @@ fix = { }; /* + * macOS 10.12 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 , 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 */