From patchwork Fri Sep 28 01:54:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Santos X-Patchwork-Id: 1516341 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5C5C9E015B for ; Fri, 28 Sep 2012 01:56:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756650Ab2I1Bz7 (ORCPT ); Thu, 27 Sep 2012 21:55:59 -0400 Received: from b-pb-sasl-quonix.pobox.com ([208.72.237.35]:51005 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756584Ab2I1Bz4 (ORCPT ); Thu, 27 Sep 2012 21:55:56 -0400 Received: from smtp.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 26D5C8EBF; Thu, 27 Sep 2012 21:55:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=sasl; bh=vOgk KvQ0NH7f/1SWV0ZF/UJaFeE=; b=tLQk/35CxFSOP6jYmuDmBQWcNK6BgeO3GyFO 3PcH6sR6D8z2SzwK7vdiItZCrSU1XzRkSBH5eB3zvQIotlamKujgSh6soeBNBJH5 zp8xEl36UQRhbEQBuHNKla3w2fDoqS/7QV7WQvD/rfHPeQnEnKhrac71p/mZwR6Q 3SqYDbY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references; q=dns; s=sasl; b= AB+IBG1oH7QQZ+74pQdXTc64V0JgjW4ktNcDBTArsucQuER8qKYnAm7atUJa4r8F QnLdPNqfV2hlyZ7j/90yhp8v2Xao51k3Ma33vyIZD/AzygSn8VsgRNAo88LJVDCh xhFQClRRaLRm0EMbULiEKJjdZ3sX2gQsYuX6iBx75zQ= Received: from b-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 0F97F8EBE; Thu, 27 Sep 2012 21:55:56 -0400 (EDT) Received: from localhost.localdomain (unknown [99.70.244.137]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by b-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 70A6C8EB5; Thu, 27 Sep 2012 21:55:53 -0400 (EDT) From: Daniel Santos To: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-sparse@vger.kernel.org, Akinobu Mita , Andi Kleen , Andrea Arcangeli , Andrew Morton , Christopher Li , David Daney , David Howells , David Rientjes , David Woodhouse , Don Zickus , Greg Kroah-Hartman , Hidetoshi Seto , "H. Peter Anvin" Cc: Daniel Santos Subject: [PATCH v6 4/25] compiler-gcc{3,4}.h: Use GCC_VERSION macro Date: Thu, 27 Sep 2012 20:54:20 -0500 Message-Id: <1348797281-25021-5-git-send-email-daniel.santos@pobox.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1348797281-25021-1-git-send-email-daniel.santos@pobox.com> References: <1348797281-25021-1-git-send-email-daniel.santos@pobox.com> X-Pobox-Relay-ID: A40B2700-090F-11E2-AEAE-18772E706CDE-06139138!b-pb-sasl-quonix.pobox.com Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Using GCC_VERSION reduces complexity, is easier to read and is GCC's recommended mechanism for doing version checks. (Just don't ask me why they didn't define it in the first place.) This also makes it easy to merge compiler-gcc{3,4}.h should somebody want to. Signed-off-by: Daniel Santos --- include/linux/compiler-gcc3.h | 8 ++++---- include/linux/compiler-gcc4.h | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h index 37d4124..7d89feb 100644 --- a/include/linux/compiler-gcc3.h +++ b/include/linux/compiler-gcc3.h @@ -2,22 +2,22 @@ #error "Please don't include directly, include instead." #endif -#if __GNUC_MINOR__ < 2 +#if GCC_VERSION < 30200 # error Sorry, your compiler is too old - please upgrade it. #endif -#if __GNUC_MINOR__ >= 3 +#if GCC_VERSION >= 30300 # define __used __attribute__((__used__)) #else # define __used __attribute__((__unused__)) #endif -#if __GNUC_MINOR__ >= 4 +#if GCC_VERSION >= 30400 #define __must_check __attribute__((warn_unused_result)) #endif #ifdef CONFIG_GCOV_KERNEL -# if __GNUC_MINOR__ < 4 +# if GCC_VERSION < 30400 # error "GCOV profiling support for gcc versions below 3.4 not included" # endif /* __GNUC_MINOR__ */ #endif /* CONFIG_GCOV_KERNEL */ diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 4506d65..b44307d 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h @@ -4,7 +4,7 @@ /* GCC 4.1.[01] miscompiles __weak */ #ifdef __KERNEL__ -# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 +# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 //# error Your version of gcc miscompiles the __weak directive # endif #endif @@ -13,11 +13,11 @@ #define __must_check __attribute__((warn_unused_result)) #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) -#if __GNUC_MINOR__ > 0 +#if GCC_VERSION >= 40102 # define __compiletime_object_size(obj) __builtin_object_size(obj, 0) #endif -#if __GNUC_MINOR__ >= 3 +#if GCC_VERSION >= 40300 /* Mark functions as cold. gcc will assume any path leading to a call to them will be unlikely. This means a lot of manual unlikely()s are unnecessary now for any paths leading to the usual suspects @@ -39,9 +39,9 @@ # define __compiletime_warning(message) __attribute__((warning(message))) # define __compiletime_error(message) __attribute__((error(message))) #endif /* __CHECKER__ */ -#endif /* __GNUC_MINOR__ >= 3 */ +#endif /* GCC_VERSION >= 40300 */ -#if __GNUC_MINOR__ >= 5 +#if GCC_VERSION >= 40500 /* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer @@ -56,9 +56,9 @@ /* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__)) -#endif /* __GNUC_MINOR__ >= 5 */ +#endif /* GCC_VERSION >= 40500 */ -#if __GNUC_MINOR__ >= 6 +#if GCC_VERSION >= 40600 /* * Tell the optimizer that something else uses this function or variable. */