From: Eric Christopher Date: Mon, 20 Mar 2017 22:31:33 +0000 (+0000) Subject: Fix parsing of htmxlintrin.h in C++ mode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bf2333d4a843364002d6c2956b2e611d026c7a3;p=clang Fix parsing of htmxlintrin.h in C++ mode - Fix a variable naming mismatch - Fix gcc extension pointer arithmetic on void to cast to char *. - Test that the header (and htmintrin.h) parse. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298318 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/htmxlintrin.h b/lib/Headers/htmxlintrin.h index 16dc7056c6..28f7d025bb 100644 --- a/lib/Headers/htmxlintrin.h +++ b/lib/Headers/htmxlintrin.h @@ -35,14 +35,10 @@ extern "C" { #endif -#define _TEXASR_PTR(TM_BUF) \ - ((texasr_t *)((TM_BUF)+0)) -#define _TEXASRU_PTR(TM_BUF) \ - ((texasru_t *)((TM_BUF)+0)) -#define _TEXASRL_PTR(TM_BUF) \ - ((texasrl_t *)((TM_BUF)+4)) -#define _TFIAR_PTR(TM_BUF) \ - ((tfiar_t *)((TM_BUF)+8)) +#define _TEXASR_PTR(TM_BUF) ((texasr_t *)((char *)(TM_BUF) + 0)) +#define _TEXASRU_PTR(TM_BUF) ((texasru_t *)((char *)(TM_BUF) + 0)) +#define _TEXASRL_PTR(TM_BUF) ((texasrl_t *)((char *)(TM_BUF) + 4)) +#define _TFIAR_PTR(TM_BUF) ((tfiar_t *)((char *)(TM_BUF) + 8)) typedef char TM_buff_type[16]; @@ -178,7 +174,7 @@ extern __inline long __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) __TM_is_conflict(void* const __TM_buff) { - texasru_t texasru = *_TEXASRU_PTR (TM_buff); + texasru_t texasru = *_TEXASRU_PTR (__TM_buff); /* Return TEXASR bits 11 (Self-Induced Conflict) through 14 (Translation Invalidation Conflict). */ return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0; diff --git a/test/Headers/htm-header.c b/test/Headers/htm-header.c new file mode 100644 index 0000000000..35a14983be --- /dev/null +++ b/test/Headers/htm-header.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-feature +htm -DHTM_HEADER -ffreestanding -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-feature +htm -DHTM_HEADER -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-feature +htm -DHTMXL_HEADER -ffreestanding -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-feature +htm -DHTMXL_HEADER -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s + +#ifdef HTM_HEADER +#include +#endif + +#ifdef HTMXL_HEADER +#include +#endif + +// Verify that simply including the headers does not generate any code +// (i.e. all inline routines in the header are marked "static") + +// CHECK: target triple = "powerpc64 +// CHECK-NEXT: {{^$}} +// CHECK-NEXT: {{llvm\..*}}