From b3bb17227802c5e510ebf58d8f420762bb8567ca Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Thu, 8 Feb 2024 18:55:40 +0100
Subject: [PATCH] Remove MFC defines from windows.cfg (#5959)
---
cfg/windows.cfg | 8 --------
test/CMakeLists.txt | 1 +
test/cfg/mfc.cpp | 16 ++++++++++++++++
test/cfg/runtests.sh | 10 ++++++++++
test/cfg/windows.cpp | 11 -----------
test/testlibrary.cpp | 4 ++++
6 files changed, 31 insertions(+), 19 deletions(-)
create mode 100644 test/cfg/mfc.cpp
diff --git a/cfg/windows.cfg b/cfg/windows.cfg
index 953b4dd2126..63b88dc2af0 100644
--- a/cfg/windows.cfg
+++ b/cfg/windows.cfg
@@ -7010,14 +7010,6 @@ HFONT CreateFont(
-
-
-
-
-
-
-
-
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 328217b8896..b14648d0105 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -148,6 +148,7 @@ if (BUILD_TESTS)
add_cfg(libcurl.c)
add_cfg(libsigc++.cpp)
add_cfg(lua.c)
+ add_cfg(mfc.cpp)
add_cfg(opencv2.cpp)
add_cfg(openmp.c)
add_cfg(openssl.c)
diff --git a/test/cfg/mfc.cpp b/test/cfg/mfc.cpp
new file mode 100644
index 00000000000..4c9cae78cfb
--- /dev/null
+++ b/test/cfg/mfc.cpp
@@ -0,0 +1,16 @@
+
+// Test library configuration for mfc.cfg
+
+#include
+
+
+class MyClass : public CObject {
+ DECLARE_DYNAMIC(MyClass)
+ DECLARE_DYNCREATE(MyClass)
+ DECLARE_SERIAL(MyClass)
+public:
+ MyClass() {}
+};
+IMPLEMENT_DYNAMIC(MyClass, CObject)
+IMPLEMENT_DYNCREATE(MyClass, CObject)
+IMPLEMENT_SERIAL(MyClass,CObject, 42)
\ No newline at end of file
diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh
index 71b865e3ee1..00cc18cd843 100755
--- a/test/cfg/runtests.sh
+++ b/test/cfg/runtests.sh
@@ -110,6 +110,12 @@ function windows_fn {
true
}
+# mfc.cpp
+function mfc_fn {
+ # TODO: Add syntax check
+ true
+}
+
# wxwidgets.cpp
function wxwidgets_fn {
# TODO: get rid of the error enabling/disabling?
@@ -480,6 +486,10 @@ function check_file {
lua_fn
${CPPCHECK} ${CPPCHECK_OPT} --library=$lib ${DIR}$f
;;
+ mfc.cpp)
+ mfc_fn
+ ${CPPCHECK} ${CPPCHECK_OPT} --platform=win64 --library=$lib ${DIR}$f
+ ;;
opencv2.cpp)
# TODO: "opencv.pc" is not commonly available in distros
#opencv2_fn
diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp
index 51559ad9a23..d7dc07a8e92 100644
--- a/test/cfg/windows.cpp
+++ b/test/cfg/windows.cpp
@@ -1144,17 +1144,6 @@ void GetShortPathName_validCode(const TCHAR* lpszPath)
delete[] buffer;
}
-class MyClass : public CObject {
- DECLARE_DYNAMIC(MyClass)
- DECLARE_DYNCREATE(MyClass)
- DECLARE_SERIAL(MyClass)
-public:
- MyClass() {}
-};
-IMPLEMENT_DYNAMIC(MyClass, CObject)
-IMPLEMENT_DYNCREATE(MyClass, CObject)
-IMPLEMENT_SERIAL(MyClass,CObject, 42)
-
void invalidPrintfArgType_StructMember(double d) { // #9672
typedef struct { CString st; } my_struct_t;
diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp
index 75e461d6389..6e1968064f6 100644
--- a/test/testlibrary.cpp
+++ b/test/testlibrary.cpp
@@ -1076,6 +1076,10 @@ class TestLibrary : public TestFixture {
const Settings s = settingsBuilder().library("std.cfg").library("microsoft_sal.cfg").build();
ASSERT_EQUALS(s.library.defines.empty(), false);
}
+ {
+ const Settings s = settingsBuilder().library("std.cfg").library("windows.cfg").library("mfc.cfg").build();
+ ASSERT_EQUALS(s.library.defines.empty(), false);
+ }
}
};