livepatch-patch-hook: fix non-rhel builds

Preprocessor doesn't stop unwinding macroses in #if clauses if one of
the conditions is false resulting in the following error when trying to
build on non-rhel system:

patch/livepatch-patch-hook.c:53:48: error: missing binary operator before token "("
       RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(7, 5))

Fix by using 2 levels of #ifs instead of &&. The same way HAVE_CALLBACKS
does.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2018-05-31 12:28:03 +02:00
parent 27accf46ee
commit 355927287d
1 changed files with 6 additions and 4 deletions

View File

@ -48,10 +48,12 @@
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) && \ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) && \
LINUX_VERSION_CODE <= KERNEL_VERSION(4, 15, 0)) || \ LINUX_VERSION_CODE <= KERNEL_VERSION(4, 15, 0))
(defined(RHEL_RELEASE_CODE) && \ # define HAVE_IMMEDIATE
RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(7, 5)) #elif defined(RHEL_RELEASE_CODE)
#define HAVE_IMMEDIATE # if RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(7, 5)
# define HAVE_IMMEDIATE
# endif
#endif #endif
#ifdef RHEL_RELEASE_CODE #ifdef RHEL_RELEASE_CODE