fix: Ignore gcc warnings and disable dll optimizations

Disable compiler optimizations for linux dll unit tests, because they
made the tests use original instead of mock syscalls.

Ignore false-positive gcc warnings:
- Ignore restrict for gcc12 and maybe-uninitialized
for gcc >= 13 warnings in Release builds in the whole project
- Ignore array-bounds warnings in specific cases

Related-To: NEO-8116
Signed-off-by: Kindracki, Jakub Tomasz <jakub.tomasz.kindracki@intel.com>
This commit is contained in:
Kindracki, Jakub Tomasz
2025-08-22 10:34:24 +00:00
committed by Compute-Runtime-Automation
parent fe58c2bb81
commit 614d1b8161
5 changed files with 37 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -71,7 +71,14 @@ TEST(ArDecoderReadLongFileName, GivenOffsetThenParsesCorrectString) {
auto name0 = readLongFileName(names, 0U);
auto name1 = readLongFileName(names, 6U);
auto name2 = readLongFileName(names, 10U);
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
auto name3 = readLongFileName(names, 40U);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
EXPECT_EQ(names, name0.begin());
EXPECT_EQ(5U, name0.size());

View File

@@ -214,7 +214,14 @@ TEST(YamlConsumeNumberOrSign, GivenInvalidCharacterThenReturnCurrentParsePositio
bool isSignOrNumber = NEO::Yaml::isSign(static_cast<char>(c)) || NEO::Yaml::isNumber(static_cast<char>(c));
char numberStr[2] = {static_cast<char>(c), '\0'};
auto expected = numberStr + (isSignOrNumber ? 1 : 0);
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
EXPECT_EQ(expected, NEO::Yaml::consumeNumberOrSign(ConstStringRef::fromArray(numberStr), numberStr)) << c;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -97,8 +97,15 @@ TEST(KernelArgMetadata, WhenParseTypeQualifiersIsCalledThenQualifierIsProperlyPa
TEST(KernelArgMetadata, WhenParseLimitedStringIsCalledThenReturnedStringDoesntContainExcessiveTrailingZeroes) {
char str1[] = "abcd\0\0\0after\0";
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
EXPECT_STREQ("abcd", NEO::parseLimitedString(str1, sizeof(str1)).c_str());
EXPECT_EQ(4U, NEO::parseLimitedString(str1, sizeof(str1)).size());
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
EXPECT_STREQ("ab", NEO::parseLimitedString(str1, 2).c_str());
EXPECT_EQ(2U, NEO::parseLimitedString(str1, 2).size());