Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MFC defines from windows.cfg #5959

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions cfg/windows.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7010,14 +7010,6 @@ HFONT CreateFont(
<define name="afx_msg" value=""/>
<define name="AFX_EXT_CLASS" value=""/>
<define name="DEBUG_NEW" value="new"/>
<define name="DECLARE_MESSAGE_MAP()" value=""/>
<define name="DECLARE_DYNAMIC(x)" value=""/>
<define name="DECLARE_DYNAMIC_CLASS(x)" value=""/>
<define name="DECLARE_DYNCREATE(x)" value=""/>
<define name="DECLARE_SERIAL(x)" value=""/>
<define name="IMPLEMENT_DYNAMIC(name,base)" value=""/>
<define name="IMPLEMENT_DYNCREATE(name,base)" value=""/>
<define name="IMPLEMENT_SERIAL(name,base,schema)" value=""/>
<define name="INVALID_HANDLE_VALUE" value="0"/>
<define name="INVALID_SOCKET" value="0"/>
<define name="WINAPI" value="__stdcall"/>
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions test/cfg/mfc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

// Test library configuration for mfc.cfg

#include <afxwin.h>


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)
10 changes: 10 additions & 0 deletions test/cfg/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions test/cfg/windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,17 +1144,6 @@ void GetShortPathName_validCode(const TCHAR* lpszPath)
delete[] buffer;
}

class MyClass : public CObject {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not duplicated so it should be moved to mfc.cpp.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... which doesn't exist, probably because mfc.cfg is just a bunch of empty defines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: we should add a CI compilation step for windows.cpp, it totally does not compile at all.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: we should add a CI compilation step for windows.cpp, it totally does not compile at all.

I was wondering about that...

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;

Expand Down
4 changes: 4 additions & 0 deletions test/testlibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
};

Expand Down
Loading