From patchwork Tue Nov 13 22:13:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Santos X-Patchwork-Id: 1736871 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 9941F3FCAE for ; Tue, 13 Nov 2012 22:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754931Ab2KMWQA (ORCPT ); Tue, 13 Nov 2012 17:16:00 -0500 Received: from nm9-vm0.access.bullet.mail.mud.yahoo.com ([66.94.237.249]:26430 "EHLO nm9-vm0.access.bullet.mail.mud.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754158Ab2KMWNx (ORCPT ); Tue, 13 Nov 2012 17:13:53 -0500 Received: from [66.94.237.127] by nm9.access.bullet.mail.mud.yahoo.com with NNFMP; 13 Nov 2012 22:13:51 -0000 Received: from [98.138.226.244] by tm2.access.bullet.mail.mud.yahoo.com with NNFMP; 13 Nov 2012 22:13:51 -0000 Received: from [127.0.0.1] by smtp115.sbc.mail.ne1.yahoo.com with NNFMP; 13 Nov 2012 22:13:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1352844831; bh=ELkxi0CCSh1j2clEPahFF+UvwC1rCg6KmdiTi20JMj4=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=RuSxhG5y9qFvR8RMiCkRue/PXArJG1U0Ja+1970uQkR2yKbOdXWbWDBuAyATQPBdMKme9hP5kWzOhw6I4hHQgCOpFjJpV90/n7fs/w3IjUkWaMZv5nOqZJOPi+8qQXTfU6qsTe+9uSiKBu6jjBedUkK/sdgkJcnbofsoLpXsVVM= X-Yahoo-Newman-Id: 567578.28409.bm@smtp115.sbc.mail.ne1.yahoo.com Received: from localhost.localdomain (danielfsantos@99.70.244.137 with login) by smtp115.sbc.mail.ne1.yahoo.com with SMTP; 13 Nov 2012 14:13:51 -0800 PST X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: b6WkN3MVM1ne16pKHj.lnAwgJvLL5czmPeIM1WNp1q_VXbQ gx50_c.gfW73XosNQ59pcswGBE_TGelPgKN97T4xMxIGGCroi9uLAa.DgEo7 Fr9zbGVrKRpKDFl4WLCsFnQiv3A9zQIMCwxxbTnf79lNQDomMM7RceEsqRzY uyQsdwjTeGoKyyR1Y42uhRAqXAlBmelEKDI0XhvGPo6fieQJz2Kcbv3vh5f0 jUiTNJjgRklIpGvFs7XKc2JBXG995.QAjOHJJPXKyyiyst4o4jiyMn..fA61 K8dCgugkfKvS6QI2ZngB739CKboVC6GQIv9TqtHbY1qKlvrOsb5gAzqwI9wC fafxK3fU6wDLMVcpQRKCMuKn.041DMz18j9cpHdgBZTjwCCc32aBojztq66f tZow4G3RDryS95U96uqRbWvzCpIgiui4A6zZKlFFE0d.USC9lTkmOAIJTOkG 3XxRtKK3KCdQAi6ATF17R8JNIvib55qzuz8pF4e9Ox3C3hXyLOZcss3ULtEE fP1mCxUAw1bBU4l5oEinqHuiUrLe5SmismakSpyixPnA- X-Yahoo-SMTP: xXkkXk6swBBAi.5wfkIWFW3ugxbrqyhyk_b4Z25Sfu.XGQ-- From: danielfsantos@att.net To: LKML , Andi Kleen , Andrea Arcangeli , Andrew Morton , Borislav Petkov , Christopher Li , Daniel Santos , David Daney , David Howells , Joe Perches , Josh Triplett , Konstantin Khlebnikov , linux-sparse@vger.kernel.org, Michel Lespinasse , Paul Gortmaker , Pavel Pisa , Peter Zijlstra , Steven Rostedt Subject: [PATCH v5 2/9] compiler-gcc.h: Add gcc-recommended GCC_VERSION macro Date: Tue, 13 Nov 2012 16:13:34 -0600 Message-Id: <1352844821-18952-2-git-send-email-daniel.santos@pobox.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1352844568-18826-1-git-send-email-daniel.santos@pobox.com> References: <1352844568-18826-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 */