From 05da696a0a11df6e1b0123a6ff684d4ac0d99ce1 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:38:16 +0100 Subject: [PATCH] Fix error when loading both gnu.cfg and bsd.cfg (#5956) I'm not sure all libraries must work together (some legitimate clashes are to be expected), but we could test some likely combinations. --- cfg/gnu.cfg | 2 -- test/cfg/gnu.c | 32 -------------------------------- test/testlibrary.cpp | 8 ++++++++ 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/cfg/gnu.cfg b/cfg/gnu.cfg index fb998dee5ae..0e3ae7f7222 100644 --- a/cfg/gnu.cfg +++ b/cfg/gnu.cfg @@ -245,8 +245,6 @@ - - false diff --git a/test/cfg/gnu.c b/test/cfg/gnu.c index 9b9ba57d71b..a259215153b 100644 --- a/test/cfg/gnu.c +++ b/test/cfg/gnu.c @@ -183,38 +183,6 @@ int uninitvar_getpw(uid_t uid, char *buf) return getpw(someUid, buf); } -// #9323, #9331 -void syntaxError_timercmp(struct timeval t) -{ - (void)timercmp(&t, &t, <); - (void)timercmp(&t, &t, <=); - (void)timercmp(&t, &t, ==); - (void)timercmp(&t, &t, !=); - (void)timercmp(&t, &t, >=); - (void)timercmp(&t, &t, >); -} - -// False negative: #9346 -void uninitvar_timercmp(struct timeval t) -{ - struct timeval uninit; - (void)timercmp(&t, &uninit, <); - (void)timercmp(&uninit, &t, <=); - (void)timercmp(&uninit, &uninit, ==); -} - -void nullPointer_timercmp(struct timeval t) -{ - // cppcheck-suppress constVariablePointer - struct timeval *p=0; - // cppcheck-suppress nullPointer - (void)timercmp(&t, p, <); - // cppcheck-suppress nullPointer - (void)timercmp(p, &t, <=); - // cppcheck-suppress nullPointer - (void)timercmp(p, p, ==); -} - // Declaration necessary because there is no specific / portable header. extern void *xcalloc(size_t nmemb, size_t size); extern void *xmalloc(size_t size); diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index fc5b2f1fda0..1bdc06f5182 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -70,6 +70,7 @@ class TestLibrary : public TestFixture { TEST_CASE(container); TEST_CASE(version); TEST_CASE(loadLibErrors); + TEST_CASE(loadLibCombinations); } static bool loadxmldata(Library &lib, const char xmldata[], std::size_t len) @@ -1065,6 +1066,13 @@ class TestLibrary : public TestFixture { // comma followed by dot LOADLIB_ERROR_INVALID_RANGE("-10:0,.5:"); } + + void loadLibCombinations() const { + { + const Settings s = settingsBuilder().library("std.cfg").library("gnu.cfg").library("bsd.cfg").build(); + ASSERT_EQUALS(s.library.defines.empty(), false); + } + } }; REGISTER_TEST(TestLibrary)