From patchwork Fri Sep 28 23:20:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Santos X-Patchwork-Id: 1527591 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2B9763FDAE for ; Fri, 28 Sep 2012 23:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964778Ab2I1XXc (ORCPT ); Fri, 28 Sep 2012 19:23:32 -0400 Received: from nm22.bullet.mail.sp2.yahoo.com ([98.139.91.92]:38861 "HELO nm22.bullet.mail.sp2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1758871Ab2I1XU5 (ORCPT ); Fri, 28 Sep 2012 19:20:57 -0400 Received: from [98.139.91.67] by nm22.bullet.mail.sp2.yahoo.com with NNFMP; 28 Sep 2012 23:20:57 -0000 Received: from [66.94.237.109] by tm7.bullet.mail.sp2.yahoo.com with NNFMP; 28 Sep 2012 23:20:57 -0000 Received: from [127.0.0.1] by omp1014.access.mail.mud.yahoo.com with NNFMP; 28 Sep 2012 23:20:57 -0000 X-Yahoo-Newman-Id: 281123.53170.bm@omp1014.access.mail.mud.yahoo.com Received: (qmail 80979 invoked from network); 28 Sep 2012 23:20:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1348874457; bh=UfNXR3oNhc1O8+R3PDOWmhudAzTjhziKrp0ZvxlX580=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=P86diP8b5dVAj1S1RbH3bzmNvHR5yoNuoMK8XiGbuMDu36WEt5cR5v+i6KuCuaZ0j5AfvK8ZfsLTmkqk9FEDSyzznCtTR1dKRblpF93Y70LsuzJ2+y4PuNoAuGA3P1j3VCb5DS+YNUSoSb9knGBl2JP/tPBkdGJ/0YSKxSgr6js= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 9ZJLYgUVM1kFGqKSue4JAXUMH.vEnA0zYkOmEKw_6dmhRr6 ybKjBz.hTY5IDqV_2raV1r9CRVS5UlQaRqkL_JiEwP6yJacx0dZQiWFVStPy GFM82LRRViEzcSedh6R_LdBXk_Ld5SFiGspurVmL7kaqcqg6SRq_7gp1IUo9 xrhgkhYWL2sdMwr4L6oyunNZYQgW8OJ9piLvvGYMKETTh_rzkrgGypB0tIEI F5UvFJMV0KJSho7SFGJvrJy86bSvl1IbUTi2KmlX6G3C0xbikKgHbzopxEgH DE2DJr0fg4FZNtakykhL0rF.gwX9ddgYmqY6MLlmnqmvidvXYu8EDc070o8z si3x5KQNo8pAh9dMec7awsQoHNz66BQIDvVwoH_R7eliOxGvIYcqBBbLOCPj pxKnbnoiRrDXZfdQxOxGhFPKKm55q2wK6v..w7RW6MRAjQoU6UH1f2.dDZmH v2Sk2v6lY5v3ZfaFv6oNsd0FqpQRsGzYFsfUjp1bc2PLl.vLnJLDjiOfrKJQ b0uOnkiDC8t5c.Lph0YfO8wTUfqbN7INrp5juzpDqcg-- X-Yahoo-SMTP: xXkkXk6swBBAi.5wfkIWFW3ugxbrqyhyk_b4Z25Sfu.XGQ-- Received: from localhost.localdomain (danielfsantos@99.70.244.137 with login) by smtp106.sbc.mail.mud.yahoo.com with SMTP; 28 Sep 2012 23:20:57 +0000 UTC From: Daniel Santos To: LKML , Andi Kleen , Andrea Arcangeli , Andrew Morton , Christopher Li , Daniel Santos , David Daney , David Howells , Joe Perches , Konstantin Khlebnikov , linux-sparse@vger.kernel.org, Michel Lespinasse , Paul Gortmaker , Pavel Pisa , Peter Zijlstra , Steven Rostedt Subject: [PATCH 3/10] compiler-gcc.h: Add gcc-recommended GCC_VERSION macro Date: Fri, 28 Sep 2012 18:20:04 -0500 Message-Id: <1348874411-28288-4-git-send-email-daniel.santos@pobox.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1348874411-28288-1-git-send-email-daniel.santos@pobox.com> References: <1348874411-28288-1-git-send-email-daniel.santos@pobox.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Throughout compiler*.h, many version checks are made. These can be simplified by using the macro that gcc's documentation recommends. However, my primary reason for adding this is that I need bug-check macros that are enabled at certain gcc versions and it's cleaner to use this macro than the tradition method: if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ => 2) If you add patch level, it gets this ugly: if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 2 || \ __GNUC_MINOR__ == 2 __GNUC_PATCHLEVEL__ >= 1)) As opposed to: if GCC_VERSION >= 40201 While having separate headers for gcc 3 & 4 eliminates some of this verbosity, they can still be cleaned up by this. See also: http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html Signed-off-by: Daniel Santos Acked-by: Borislav Petkov Acked-by: David Rientjes --- include/linux/compiler-gcc.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 6a6d7ae..24545cd 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -5,6 +5,9 @@ /* * Common definitions for all gcc versions go here. */ +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) /* Optimization barrier */