All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Markos Chandras <mchandras@suse.de>
Cc: dev@dpdk.org
Subject: Re: [PATCH] mk: toolchain: gcc: query the compiler macros to obtain the gcc version
Date: Tue, 22 Mar 2016 23:34:09 +0100	[thread overview]
Message-ID: <2653966.ML0Fr8PsdQ@xps13> (raw)
In-Reply-To: <1458666816-29778-1-git-send-email-mchandras@suse.de>

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 <mchandras@suse.de>
> ---
> 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.

> As a result of which, the gcc-4.x comparison (40 against 5) does not
> work leading to tons of warnings and failures during build. This patch
> aims to change the way the gcc version is obtained by using the gcc macros
> directly.

Thanks for catching.

> -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?

  reply	other threads:[~2016-03-22 22:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 17:13 [PATCH] mk: toolchain: gcc: query the compiler macros to obtain the gcc version Markos Chandras
2016-03-22 22:34 ` Thomas Monjalon [this message]
2016-03-22 22:50   ` Markos Chandras
2016-03-23  9:49     ` Thomas Monjalon
2016-03-23  9:56       ` Markos Chandras
2016-03-23 10:00 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2653966.ML0Fr8PsdQ@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=mchandras@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.