1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-06-20 01:17:49 +02:00

Fix float-equal compiler warnings.

ed390780 added this warning but included an extra dash which caused it to be ignored. Remove the extra dash so the warning is applied.

Also remove some unused test code that violated the new warning.
This commit is contained in:
David Steele
2026-01-23 16:10:09 +07:00
parent c2b10a85b7
commit b8b0dbceb3
4 changed files with 1 additions and 33 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ warning_enable = [
'-Wduplicated-branches',
# Warn if floating-point values are used in equality comparisons
'--Wfloat-equal',
'-Wfloat-equal',
# Enable -Wformat plus -Wnonnull, -Wformat-nonliteral, -Wformat-security, and -Wformat-y2k
'-Wformat=2',
-19
View File
@@ -519,25 +519,6 @@ hrnTestResultBool(int actual, int expected)
hrnTestResultEnd();
}
void
hrnTestResultDouble(double actual, double expected)
{
ASSERT(harnessTestLocal.result.running);
if (actual != expected)
{
char actualZ[318];
char expectedZ[318];
snprintf(actualZ, sizeof(actualZ), "%f", actual);
snprintf(expectedZ, sizeof(expectedZ), "%f", expected);
hrnTestResultDiff(actualZ, expectedZ);
}
hrnTestResultEnd();
}
void
hrnTestResultInt64(int64_t actual, int64_t expected, HarnessTestResultOperation operation)
{
-12
View File
@@ -259,18 +259,6 @@ Macros to compare results of common data types
#define TEST_RESULT_BOOL(statement, expected, comment) \
TEST_RESULT_BOOL_PARAM(statement, expected, comment)
#define TEST_RESULT_DOUBLE_PARAM(statement, expected, comment) \
do \
{ \
TEST_RESULT_INFO(comment); \
hrnTestResultBegin(#statement, true); \
hrnTestResultDouble(statement, expected); \
} \
while (0)
#define TEST_RESULT_DOUBLE(statement, expected, comment) \
TEST_RESULT_DOUBLE_PARAM(statement, expected, comment)
#define TEST_RESULT_INT_PARAM(statement, expected, operation, comment) \
do \
{ \
-1
View File
@@ -60,7 +60,6 @@ void hrnTestResultEnd(void);
// Test results for various types
void hrnTestResultBool(int actual, int expected);
void hrnTestResultDouble(double actual, double expected);
void hrnTestResultInt64(int64_t actual, int64_t expected, HarnessTestResultOperation operation);
void hrnTestResultPtr(const void *actual, const void *expected, HarnessTestResultOperation operation);