From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 5ED05214A for ; Wed, 23 Mar 2016 10:51:09 +0100 (CET) Received: by mail-wm0-f43.google.com with SMTP id l68so15994661wml.1 for ; Wed, 23 Mar 2016 02:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=4d33U3EQW8lFNJK/NwuM+bLzE2Qj2gVW1Z7pC6hvNTI=; b=o7vT9N6PwtSqj81o4v1DbT6eGGIRpAL6VND3uHCBFjyFoNpRNVALkKX1wCxudwahct /nbbDzXreY2yWZ4kpVBL3FQkMXc96fXnpkliXLZ74r+aOC9nwfmFae9RqkMgiLK+lk6s c8ZubY+IzEryVoYriNN5HKFYl+vfKB+P6zzWLQakjphz0IOav3WRUkQR8IxRDBt7fK+L W/FaeDgShtYeP+i5dyfGu06ifovAWSywM0mPHqB7M5bNTUswszHcTEggMCDVn8AG3p3M zhGpXnrsL9LqcplG6oQTtUVEAFVPO0enre7XBk3JQ0uxOkbotANsKLOdWuHqfWDsNELB C+4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=4d33U3EQW8lFNJK/NwuM+bLzE2Qj2gVW1Z7pC6hvNTI=; b=a05UKTkiRjYlnE/P+qP8h/NEg1LWUFE4UuqHIXUJklq0QYKGfHnZKvZf518NX/4EvD /8oCY0gR8umyaaj3pthXGz6h5wu5VL2rBr4ODQCHfAmOMbJpkpzgX1D7KR2Zc14vXSGh hT+BwXh3us8w7yNV/nFSMHhsUeXEgvfwXQ3tVmykL6sAGxMEsFHTePjuBLA2B5SGSmV0 fC3lFoB6Md6pm4oiModk56R10gX2uLoVC8egjHGEaM5Sj+v46Un2fY+Ntiii3hdoa0Bi 9U25pOFA6mV7rm9ISaMUz8rDiH2kE/WDvW7y30/Etmqpg4LdDDT1lUAy+b9ncdOCALY/ NEFg== X-Gm-Message-State: AD7BkJJO+s5JU7ShU1OUM6jk4RiW7B75cHxR53hZQcyc6Ra0ID85KcClgFGTXBDxWG5BHmRQ X-Received: by 10.194.95.73 with SMTP id di9mr2501678wjb.152.1458726669215; Wed, 23 Mar 2016 02:51:09 -0700 (PDT) Received: from xps13.localnet (91.111.75.86.rev.sfr.net. [86.75.111.91]) by smtp.gmail.com with ESMTPSA id gt7sm1713689wjc.1.2016.03.23.02.51.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Mar 2016 02:51:08 -0700 (PDT) From: Thomas Monjalon To: Markos Chandras Cc: dev@dpdk.org Date: Wed, 23 Mar 2016 10:49:27 +0100 Message-ID: <10969139.eXE434OmqC@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <56F1CC20.50707@suse.de> References: <1458666816-29778-1-git-send-email-mchandras@suse.de> <2653966.ML0Fr8PsdQ@xps13> <56F1CC20.50707@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] mk: toolchain: gcc: query the compiler macros to obtain the gcc version X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2016 09:51:09 -0000 2016-03-22 22:50, Markos Chandras: > On 22/03/16 22:34, Thomas Monjalon wrote: > > 2016-03-22 17:13, Markos Chandras: > >> This is similar to what's being used in the Linux kernel. Querying the > >> GCC macros directly gives more accurate results compared to -dumpversion > >> which could vary across distributions. > >> > >> Signed-off-by: Markos Chandras > >> --- > >> In openSUSE Tumbleweed (and in any other SUSE distribution which > >> uses (or will use) gcc >= 5), gcc -dumpversion returns '5'. This is on > >> purpose as discussed in https://bugzilla.opensuse.org/show_bug.cgi?id=941428 > > > > Good to know. It could be in the commit log. > > I can add this information to the commit message and send a v2 if needed. I will apply with this info. > >> -GCC_VERSION = $(subst .,,$(shell $(CC) -dumpversion | cut -f1-2 -d.)) > >> +GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1) > >> +GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1) > >> +GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR) > > > > Are we sure the minor will always be only one digit? > > Well, I can't be sure but minor has always been a single digit since gcc > >= 3 if I am not mistaken. But does it matter? What if it is two or more > digits? The previous code did something similar so if you had gcc > 5.12.34 installed (and lets assume this is what is being returned by > -dumpversion), it would have returned 512. The comparison would still > work as it is at the moment no? Yes, I was asking for an improvement in case it could happen. But GCC is probably conservative with numbering so we can keep only one digit.