From patchwork Tue Jun 17 11:09:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?0JjQu9GM0Y8g0JzQuNGF0LDQu9GM0YbQvtCy?= X-Patchwork-Id: 360446 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 163DF140098 for ; Tue, 17 Jun 2014 21:10:06 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; q=dns; s=default; b=u+v709MAWR69wB0EHcJ+FialZe ckTif3aJ3VDhkVhWtjADgiK8y53TtzjSt/fOu7EGuyWH+g7JnGjx00qZH+vy/4jf wEDJAj2XxNylfMBfO34rTr9smLQoUYwhGCxA3ypvlRaBPVf265xJdS+CBWms8TRi VqIhLPMPKTMDkqd/M= 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 :content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; s=default; bh=B4QiA8VPOlT2jq+RAjbvoq2Q/Qw=; b= D8168/jSrDcATg/2eXm1/zW+C0kDXGuuNbt946px8RL/V5V/CiuIQl+O9WmSnZd2 iAFCCVB+TEoXxaqHM4l4PKSr3G5AcAGiN7qVDVxHV5fykdSomJ6ywhJuZSny7gJl ygEnJxoF/wfra15hIWc9ONuf0U7juMdlS7FRMhsPtHE= Received: (qmail 19435 invoked by alias); 17 Jun 2014 11:09:59 -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 19417 invoked by uid 89); 17 Jun 2014 11:09:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f180.google.com Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 17 Jun 2014 11:09:27 +0000 Received: by mail-wi0-f180.google.com with SMTP id hi2so5590718wib.7 for ; Tue, 17 Jun 2014 04:09:24 -0700 (PDT) X-Received: by 10.180.210.134 with SMTP id mu6mr6955510wic.18.1403003364657; Tue, 17 Jun 2014 04:09:24 -0700 (PDT) Received: from [192.168.1.38] ([91.149.173.33]) by mx.google.com with ESMTPSA id q4sm13942226eeg.9.2014.06.17.04.09.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 04:09:23 -0700 (PDT) From: =?utf-8?B?0JjQu9GM0Y8g0JzQuNGF0LDQu9GM0YbQvtCy?= Subject: Bug 61407 - Build errors on latest OS X 10.10 Yosemite with Xcode 6 on GCC 4.8.3 Message-Id: <02D530CB-20AE-44AA-8D62-658F46915ACC@gmail.com> Date: Tue, 17 Jun 2014 14:09:22 +0300 To: gcc-patches@gcc.gnu.org Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1955.2\)) Hello. This patch fixes gcc build problems on the latest OS X 10.10 SDK beta (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407) fixincludes/ChangeLog * inclhack.def (darwin14_has_feature): New fix * fixincl.x: Regenerate * tests/base/Availability.h: Added gcc/ChangeLog * config/darwin-c.c (version_as_macro): Added compatibility with OS X 10.10 macro version macro and triplet * config/darwin-driver.c (darwin_find_version_from_kernel): Bumped max kernel version libsanitizer/ChangeLog * sanitizer_common/sanitizer_platform_limits_posix.cc: Fixed 32-bit compatible dirent struct for OS X * sanitizer_common/sanitizer_platform_limits_posix.h: Likewise With regards, Ilya Mikhaltsou diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 6a1136c..b536080 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -4751,4 +4751,33 @@ fix = { test_text = "extern char *\tsprintf();"; }; + +/* + * Fix stdio.h using C++ __has_feature built-in on OS X 10.10 + */ +fix = { + hackname = darwin14_has_feature; + files = Availability.h; + mach = "*-*-darwin14.0*"; + + c_fix = wrap; + c_fix_arg = <<- _HasFeature_ + +/* + * GCC doesn't support __has_feature built-in in C mode and + * using defined(__has_feature) && __has_feature in the same + * macro expression is not valid. So, easiest way is to define + * for this header __has_feature as a macro, returning 0, in case + * it is not defined internally + */ +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + + +_HasFeature_; + + test_text = ''; +}; + /*EOF*/ diff --git a/fixincludes/tests/base/Availability.h b/fixincludes/tests/base/Availability.h new file mode 100644 index 0000000..807c40d --- /dev/null +++ b/fixincludes/tests/base/Availability.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/Availability.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + +#ifndef FIXINC_WRAP_AVAILABILITY_H_DARWIN14_HAS_FEATURE +#define FIXINC_WRAP_AVAILABILITY_H_DARWIN14_HAS_FEATURE 1 + + +/* GCC doesn't support __has_feature built-in in C mode and + * using defined(__has_feature) && __has_feature in the same + * macro expression is not valid. So, easiest way is to define + * for this header __has_feature as a macro, returning 0, in case + * it is not defined internally + */ +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + + +#if defined( DARWIN14_HAS_FEATURE_CHECK ) + +#endif /* DARWIN14_HAS_FEATURE_CHECK */ + +#endif /* FIXINC_WRAP_AVAILABILITY_H_DARWIN14_HAS_FEATURE */ diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 892ba35..39f795f 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -572,20 +572,31 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) /* Return the value of darwin_macosx_version_min suitable for the __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. - Print a warning if the version number can't be understood. */ + so '10.4.2' becomes 1040 and '10.10.0' becomes 101000. The lowest + digit is always zero. Print a warning if the version number + can't be understood. */ static const char * version_as_macro (void) { - static char result[] = "1000"; + static char result[7] = "1000"; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, "10.", 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - && darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT(darwin_macosx_version_min[minorDigitIdx])) { + /* Starting with 10.10 numeration for mactro changed */ + result[3] = darwin_macosx_version_min[minorDigitIdx++]; + result[4] = '0'; + result[5] = '0'; + result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + && darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 8b6ae93..a115616 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -57,7 +57,7 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers > 4 + 9) + if (major_vers > 4 + 10) goto parse_failed; if (*version_p++ != '.') goto parse_failed; diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index a93d38d..6783108 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -940,8 +940,10 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC && ( !defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T) CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); +#elif SANITIZER_MAC +// There is no d_seekoff with non 64-bit ino_t #elif SANITIZER_FREEBSD // There is no 'd_off' field on FreeBSD. #else diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index dece2d3..c830486 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -392,12 +392,20 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if ! defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { + unsigned int d_ino; + unsigned short d_reclen; + // more fields that we don't care about + }; +# endif #elif SANITIZER_FREEBSD struct __sanitizer_dirent { unsigned int d_fileno;