Suppress a bogus coverity warning

This commit is contained in:
vitaut 2015-10-21 08:30:10 -07:00
parent 13e0e38d99
commit ab25cd2c8b
3 changed files with 6 additions and 4 deletions

View File

@ -140,7 +140,7 @@ template <>
struct IntChecker<true> { struct IntChecker<true> {
template <typename T> template <typename T>
static bool fits_in_int(T value) { static bool fits_in_int(T value) {
return value >= INT_MIN && value <= INT_MAX; return internal::check(value >= INT_MIN) && value <= INT_MAX;
} }
}; };

View File

@ -61,10 +61,10 @@ TEST(FormatTest, StrError) {
EXPECT_ASSERT(fmt::safe_strerror(EDOM, message = 0, 0), "invalid buffer"); EXPECT_ASSERT(fmt::safe_strerror(EDOM, message = 0, 0), "invalid buffer");
EXPECT_ASSERT(fmt::safe_strerror(EDOM, message = buffer, 0), "invalid buffer"); EXPECT_ASSERT(fmt::safe_strerror(EDOM, message = buffer, 0), "invalid buffer");
buffer[0] = 'x'; buffer[0] = 'x';
#ifdef _GNU_SOURCE #if defined(_GNU_SOURCE) && !defined(__COVERITY__)
// Use invalid error code to make sure that safe_strerror returns an error // Use invalid error code to make sure that safe_strerror returns an error
// message in the buffer rather than a pointer to a static string. // message in the buffer rather than a pointer to a static string.
volatile int error_code = -1; int error_code = -1;
#else #else
int error_code = EDOM; int error_code = EDOM;
#endif #endif

View File

@ -326,11 +326,13 @@ TEST(FileTest, Dup) {
EXPECT_EQ(FILE_CONTENT, read(copy, std::strlen(FILE_CONTENT))); EXPECT_EQ(FILE_CONTENT, read(copy, std::strlen(FILE_CONTENT)));
} }
#ifndef __COVERITY__
TEST(FileTest, DupError) { TEST(FileTest, DupError) {
volatile int value = -1; int value = -1;
EXPECT_SYSTEM_ERROR_NOASSERT(File::dup(value), EXPECT_SYSTEM_ERROR_NOASSERT(File::dup(value),
EBADF, "cannot duplicate file descriptor -1"); EBADF, "cannot duplicate file descriptor -1");
} }
#endif
TEST(FileTest, Dup2) { TEST(FileTest, Dup2) {
File f = open_file(); File f = open_file();