Define `static_assert()` when not defined by kernel
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 4 May 2021 19:48:52 +0000 (15:48 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 6 May 2021 17:51:31 +0000 (13:51 -0400)
commitc383eb0d21d085c9814f1406fde4eabac149f8c1
treec2ec8543c11e2ba1495f362fdd0aa749998e2452
parentfc2778a7b1e9be23462b6cf602cf91b3828056ae
Define `static_assert()` when not defined by kernel

This macro is useful for build-time assertions. It was added in kernel
v5.1. It uses the C11 _Static_assert macro that was implemented with gcc
4.6. There is support for the _Static_assert in all C modes, including
gnu89.

Since our minimal gcc version is 4.8, we can simply define it manually
if the kernel is older than v5.1.

Kernel commit adding this macro:
  commit 6bab69c65013bed5fce9f101a64a84d0385b3946
  Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
  Date:   Thu Mar 7 16:27:00 2019 -0800

      build_bug.h: add wrapper for _Static_assert

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5aa250f60f9dca4f13b8bcc093a006034c28e526
include/wrapper/compiler.h
This page took 0.025775 seconds and 4 git commands to generate.