From: Joao Martins <joao.m.martins@oracle.com>
To: Vaibhav Jain <vaibhav@linux.ibm.com>,
nvdimm@lists.linux.dev, Vishal Verma <vishal.l.verma@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Ira Weiny <ira.weiny@intel.com>,
Shivaprasad G Bhat <sbhat@linux.ibm.com>,
Tarun Sahu <tsahu@linux.ibm.com>
Subject: Re: [ndctl PATCH] util/size.h: Fix build error for GCC < 10
Date: Wed, 2 Mar 2022 10:57:35 +0000 [thread overview]
Message-ID: <e8be0c0b-a74f-1e19-9a67-082d014ef4c1@oracle.com> (raw)
In-Reply-To: <20220226113955.526036-1-vaibhav@linux.ibm.com>
On 2/26/22 11:39, Vaibhav Jain wrote:
> Building with GCC 8.4.1 results in following build error for 'util/size.c':
>
> ../util/size.h:57:16: error: missing binary operator before token "("
> __has_builtin(__builtin_mul_overflow) && \
>
> This is caused due to missing '__has_builtin' preprocessor operator in GCC
> versions < 10.0.0. The patch updates the check for CLANG's availability of
> __builtin_{mul,add}_overflow to prevent preprocessor from evaluating the
> expression "___has_builtin(__builtin_mul_overflow) &&
> __has_builtin(__builtin_add_overflow)".
>
> Fixes:10653a171bc0("util/size.h: fix build for older compilers")
> Reported-by: Tarun Sahu <tsahu@linux.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
> ---
> util/size.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/util/size.h b/util/size.h
> index 1cb06690261b..02baa77fe649 100644
> --- a/util/size.h
> +++ b/util/size.h
> @@ -53,11 +53,12 @@ static inline bool is_power_of_2(unsigned long long v)
> #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
> #endif
>
> -#if __clang__ && \
> - __has_builtin(__builtin_mul_overflow) && \
> +#if __clang__
> +#if __has_builtin(__builtin_mul_overflow) && \
> __has_builtin(__builtin_add_overflow)
> #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
> #endif
> +#endif
>
> #if COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW
>
prev parent reply other threads:[~2022-03-02 10:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-26 11:39 [ndctl PATCH] util/size.h: Fix build error for GCC < 10 Vaibhav Jain
2022-03-02 10:57 ` Joao Martins [this message]
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=e8be0c0b-a74f-1e19-9a67-082d014ef4c1@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=ira.weiny@intel.com \
--cc=nvdimm@lists.linux.dev \
--cc=sbhat@linux.ibm.com \
--cc=tsahu@linux.ibm.com \
--cc=vaibhav@linux.ibm.com \
--cc=vishal.l.verma@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox