Enabling gcc8

Change-Id: Ib43600b323be6e8d4a118fecc656a3924e05959c
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk 2018-05-17 23:57:53 +02:00 committed by sys_ocldev
parent a9a1384ef5
commit 6fe9840fde
11 changed files with 48 additions and 37 deletions

View File

@ -17,7 +17,7 @@ components:
branch: infra
clean_on_sync: true
dest_dir: infra
revision: c174a6eaf351ae68abbc285c837ab29c7544fcfc
revision: 8b13573ecf55f1f1142a815fdc181d34c29c7574
type: git
internal:
branch: master

View File

@ -3878,7 +3878,7 @@ typedef struct tagSTATE_BASE_ADDRESS {
}
}
inline uint32_t getStatelessDataPortAccessMemoryObjectControlStateIndexToMocsTables(void) const {
return (uint32_t)(((TheStructure.RawData[3] & 0x00780000) == 0x00710000) ? 0 : 2);
return (uint32_t)(((TheStructure.RawData[3] & 0x007f0000u) == 0x00710000u) ? 0 : 2);
}
inline void setInstructionMemoryObjectControlState(const uint32_t value) {
TheStructure.Common.InstructionMemoryObjectControlState_AgeForQuadlru = value;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -27,20 +27,17 @@
#include <cstring>
#include <string>
inline int strcpy_s(char *dst, size_t numberOfElements, const char *src) {
inline int strcpy_s(char *dst, size_t dstSize, const char *src) {
if ((dst == nullptr) || (src == nullptr)) {
return -EINVAL;
}
size_t length = strlen(src);
if (numberOfElements < length) {
if (dstSize <= length) {
return -ERANGE;
}
#ifndef strlcpy
#define strlcpy(d, s, n) snprintf((d), (n), "%s", (s))
#endif
strlcpy(dst, src, numberOfElements);
strncpy(dst, src, length);
dst[length] = '\0';
return 0;
}

View File

@ -915,7 +915,7 @@ inline void Kernel::makeArgsResident(CommandStreamReceiver &commandStreamReceive
auto pSVMAlloc = (GraphicsAllocation *)kernelArguments[argIndex].object;
commandStreamReceiver.makeResident(*pSVMAlloc);
} else if (Kernel::isMemObj(kernelArguments[argIndex].type)) {
auto clMem = (const cl_mem)kernelArguments[argIndex].object;
auto clMem = const_cast<cl_mem>(static_cast<const _cl_mem *>(kernelArguments[argIndex].object));
auto memObj = castToObjectOrAbort<MemObj>(clMem);
DEBUG_BREAK_IF(memObj == nullptr);
if (memObj->isImageFromImage()) {
@ -935,7 +935,7 @@ void Kernel::updateWithCompletionStamp(CommandStreamReceiver &commandStreamRecei
for (decltype(numArgs) argIndex = 0; argIndex < numArgs; argIndex++) {
if (kernelArguments[argIndex].object) {
if (Kernel::isMemObj(kernelArguments[argIndex].type)) {
auto clMem = (const cl_mem)kernelArguments[argIndex].object;
auto clMem = const_cast<cl_mem>(static_cast<const _cl_mem *>(kernelArguments[argIndex].object));
auto memObj = castToObjectOrAbort<MemObj>(clMem);
DEBUG_BREAK_IF(memObj == nullptr);
memObj->setCompletionStamp(*completionStamp, nullptr, nullptr);
@ -999,7 +999,7 @@ void Kernel::getResidency(std::vector<Surface *> &dst) {
auto pSVMAlloc = (GraphicsAllocation *)kernelArguments[argIndex].object;
dst.push_back(new GeneralSurface(pSVMAlloc));
} else if (Kernel::isMemObj(kernelArguments[argIndex].type)) {
auto clMem = (const cl_mem)kernelArguments[argIndex].object;
auto clMem = const_cast<cl_mem>(static_cast<const _cl_mem *>(kernelArguments[argIndex].object));
auto memObj = castToObject<MemObj>(clMem);
DEBUG_BREAK_IF(memObj == nullptr);
dst.push_back(new MemObjSurface(memObj));
@ -1028,7 +1028,7 @@ bool Kernel::requiresCoherency() {
}
if (Kernel::isMemObj(kernelArguments[argIndex].type)) {
auto clMem = (const cl_mem)kernelArguments[argIndex].object;
auto clMem = const_cast<cl_mem>(static_cast<const _cl_mem *>(kernelArguments[argIndex].object));
auto memObj = castToObjectOrAbort<MemObj>(clMem);
if (memObj->getGraphicsAllocation()->isCoherent()) {
return true;

View File

@ -30,4 +30,4 @@ typedef VAStatus (*VADeriveImagePFN)(VADisplay vaDisplay, VASurfaceID vaSurface,
typedef VAStatus (*VADestroyImagePFN)(VADisplay vaDisplay, VAImageID vaImageId);
typedef VAStatus (*VAExtGetSurfaceHandlePFN)(VADisplay vaDisplay, VASurfaceID *vaSurface, unsigned int *handleId);
typedef VAStatus (*VASyncSurfacePFN)(VADisplay vaDisplay, VASurfaceID vaSurface);
typedef VAPrivFunc (*VAGetLibFuncPFN)(VADisplay vaDisplay, const char *func);
typedef void *(*VAGetLibFuncPFN)(VADisplay vaDisplay, const char *func);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -56,12 +56,12 @@ void VASharingFunctions::initFunctions() {
if (DebugManager.flags.EnableVaLibCalls.get()) {
libHandle = fdlopen(Os::libvaDllName, RTLD_LAZY);
if (libHandle) {
vaDisplayIsValidPFN = (VADisplayIsValidPFN)fdlsym(libHandle, "vaDisplayIsValid");
vaDeriveImagePFN = (VADeriveImagePFN)fdlsym(libHandle, "vaDeriveImage");
vaDestroyImagePFN = (VADestroyImagePFN)fdlsym(libHandle, "vaDestroyImage");
vaSyncSurfacePFN = (VASyncSurfacePFN)fdlsym(libHandle, "vaSyncSurface");
vaGetLibFuncPFN = (VAGetLibFuncPFN)fdlsym(libHandle, "vaGetLibFunc");
vaExtGetSurfaceHandlePFN = (VAExtGetSurfaceHandlePFN)getLibFunc("DdiMedia_ExtGetSurfaceHandle");
vaDisplayIsValidPFN = reinterpret_cast<VADisplayIsValidPFN>(fdlsym(libHandle, "vaDisplayIsValid"));
vaDeriveImagePFN = reinterpret_cast<VADeriveImagePFN>(fdlsym(libHandle, "vaDeriveImage"));
vaDestroyImagePFN = reinterpret_cast<VADestroyImagePFN>(fdlsym(libHandle, "vaDestroyImage"));
vaSyncSurfacePFN = reinterpret_cast<VASyncSurfacePFN>(fdlsym(libHandle, "vaSyncSurface"));
vaGetLibFuncPFN = reinterpret_cast<VAGetLibFuncPFN>(fdlsym(libHandle, "vaGetLibFunc"));
vaExtGetSurfaceHandlePFN = reinterpret_cast<VAExtGetSurfaceHandlePFN>(getLibFunc("DdiMedia_ExtGetSurfaceHandle"));
} else {
vaDisplayIsValidPFN = nullptr;
vaDeriveImagePFN = nullptr;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -56,7 +56,7 @@ class VASharingFunctions : public SharingFunctions {
return vaSyncSurfacePFN(vaDisplay, vaSurface);
}
VAPrivFunc getLibFunc(const char *func) {
void *getLibFunc(const char *func) {
if (vaGetLibFuncPFN) {
return vaGetLibFuncPFN(vaDisplay, func);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -91,21 +91,35 @@ TEST(StringHelpers, strcpy) {
ASSERT_EQ(sizeof(dst), sizeof(src));
auto ret = strcpy_s(nullptr, sizeof(dst), src);
auto ret = strcpy_s(nullptr, 0, src);
EXPECT_EQ(ret, -EINVAL);
ret = strcpy_s(dst, sizeof(dst), nullptr);
ret = strcpy_s(nullptr, sizeof(dst), src);
EXPECT_EQ(ret, -EINVAL);
ret = strcpy_s(nullptr, 0, nullptr);
EXPECT_EQ(ret, -EINVAL);
ret = strcpy_s(nullptr, sizeof(dst), nullptr);
EXPECT_EQ(ret, -EINVAL);
ret = strcpy_s(dst, 0, nullptr);
EXPECT_EQ(ret, -EINVAL);
ret = strcpy_s(dst, strlen(src) / 2, src);
EXPECT_EQ(ret, -ERANGE);
memset(dst, 0, sizeof(dst));
ret = strcpy_s(dst, strlen(src), src);
EXPECT_EQ(ret, -ERANGE);
char pattern = 0x5a;
memset(dst, pattern, sizeof(dst));
ret = strcpy_s(dst, sizeof(dst), src);
EXPECT_EQ(ret, 0);
EXPECT_EQ(0, memcmp(dst, src, strlen(src)));
for (size_t i = strlen(src); i < sizeof(dst); i++)
EXPECT_EQ(0, dst[i]);
EXPECT_EQ(0, dst[strlen(src)]);
for (size_t i = strlen(src) + 1; i < sizeof(dst); i++)
EXPECT_EQ(pattern, dst[i]);
}
TEST(StringHelpers, strnlen) {

View File

@ -224,10 +224,10 @@ static uint32_t ImageType[] = {
CL_MEM_OBJECT_IMAGE1D_ARRAY,
CL_MEM_OBJECT_IMAGE2D_ARRAY};
typedef decltype(numReadWriteSurfaceFormats) ReadWriteSurfaceFormatsCountType;
decltype(numReadWriteSurfaceFormats) readWriteSurfaceFormatsStart = 0u;
INSTANTIATE_TEST_CASE_P(
Redescribe,
ImageRedescribeTest,
testing::Combine(
::testing::Range(static_cast<ReadWriteSurfaceFormatsCountType>(0u), numReadWriteSurfaceFormats),
::testing::ValuesIn(ImageType)));
::testing::Range(readWriteSurfaceFormatsStart, numReadWriteSurfaceFormats),
::testing::ValuesIn(ImageType)));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -60,7 +60,7 @@ class VASharingFunctionsMock : public VASharingFunctions {
return (VAStatus)0; // success
};
static VAPrivFunc mockVaGetLibFunc(VADisplay vaDisplay, const char *func) {
static void *mockVaGetLibFunc(VADisplay vaDisplay, const char *func) {
vaGetLibFuncCalled++;
return nullptr;
};

View File

@ -30,7 +30,7 @@ TEST(SkuInfoTransferTest, givenFeatureTableWhenFillingStructureForGmmThenCopyOnl
_SKU_FEATURE_TABLE requestedFtrTable = {};
_SKU_FEATURE_TABLE refFtrTable = {};
FeatureTable featureTable;
memset(&featureTable, 1, sizeof(FeatureTable));
memset(reinterpret_cast<void *>(&featureTable), 1, sizeof(FeatureTable));
SkuInfoTransfer::transferFtrTableForGmm(&requestedFtrTable, &featureTable);
SkuInfoBaseReference::fillReferenceFtrForTransfer(refFtrTable);
@ -43,7 +43,7 @@ TEST(SkuInfoTransferTest, givenWaTableWhenFillingStructureForGmmThenCopyOnlySele
_WA_TABLE refWaTable = {};
WorkaroundTable waTable;
refWaTable = {};
memset(&waTable, 1, sizeof(WorkaroundTable));
memset(reinterpret_cast<void *>(&waTable), 1, sizeof(WorkaroundTable));
SkuInfoTransfer::transferWaTableForGmm(&requestedWaTable, &waTable);
SkuInfoBaseReference::fillReferenceWaForTransfer(refWaTable);