Re: [PATCHv2] Add configure check for _Static_assert()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas,

On Fri, Sep 6, 2013 at 10:27 AM, Thomas Petazzoni
<thomas.petazzoni@xxxxxxxxxxxxxxxxxx> wrote:
> Commit 8efede20ef ("Use _Static_assert") introduced the usage of
> _Static_assert(). However, _Static_assert() is a fairly new thing,
> since it was introduced only in gcc 4.6. In order to support older
> compilers, this patch adds a configure.in test that checks whether
> _Static_assert() is usable or not, and adjust the behavior of the
> assert_cc() macro accordingly.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx>
> ---
> Changes since v1:
>  * When _Static_assert() is not available, rely on the previously used
>    sizeof() trick, as suggested by Lucas de Marchi.
> ---
>  configure.ac    | 6 ++++++
>  libkmod/macro.h | 5 +++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 40e54cf..cbe12f3 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -52,6 +52,12 @@ AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
>  # Check kernel headers
>  AC_CHECK_HEADERS_ONCE([linux/module.h])
>
> +AC_MSG_CHECKING([whether _Static_assert() is supported])
> +AC_COMPILE_IFELSE(
> +       [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
> +        [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define is _Static_assert() is available])

I've fixed the typo s/is/if/ and pushed.

Thanks
Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux