hv: fix a minor bug of static checks

When a macro is expanded, the two tokens on either side of each ‘##’ operator
are combined into a single token, which then replaces the ‘##’ and the two
original tokens in the macro expansion. So we need use CAT__ to expand the
__LINE__ MACRO and use CAT_ to combine the expaneded MACRO.

Tracked-on: #1750
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Li, Fei1 2018-11-06 23:43:47 +08:00 committed by lijinxia
parent 0800624fe5
commit 121454c4bd
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,8 @@
#include <hypervisor.h>
#include <vm0_boot.h>
#define CAT_(A,B) A ## B
#define CAT__(A,B) A ## B
#define CAT_(A,B) CAT__(A,B)
#define CTASSERT(expr) \
typedef int CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1]

View File

@ -5,7 +5,8 @@
*/
#include <acrn_common.h>
#define CAT_(A,B) A ## B
#define CAT__(A,B) A ## B
#define CAT_(A,B) CAT__(A,B)
#define CTASSERT(expr) \
typedef int CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1]