// Stubs for the main.cpp symbols referenced by the rest of the app but not
// needed by the GroupCell layout unit test. main.cpp is excluded from the
// wxmTestApp object library because it holds the application's real main()/
// app-bootstrap; the test provides its own minimal main().
//
// NewWindow() opens a GUI window; the layout test never triggers it, so a no-op
// definition is enough to satisfy the linker.
#include "wxMaxima.h"

void MyApp::NewWindow(const wxString &, bool, bool, unsigned char *, std::size_t) {}

// wxGetApp() is generated by wxIMPLEMENT_APP in main.cpp (excluded from the test
// harness). wxMaxima::FileMenu references it, but the layout test never calls it.
// GNU ld dead-strips the unreferenced FileMenu (--gc-sections), so the Linux link
// succeeds, but macOS ld64 keeps it and the undefined wxGetApp() breaks the arm64
// link. Provide the same definition wxIMPLEMENT_GET_APP would generate so the test
// links on every platform.
//
// reinterpret_cast (not static_cast) on purpose: under -fsanitize=undefined the
// downcast to MyApp* emits a vptr type-check whose descriptor references
// "typeinfo for MyApp", which lives only in main.cpp (excluded here) and so
// breaks the sanitizer link. reinterpret_cast is not instrumented, and since
// this function is never actually called by the tests the cast is harmless.
MyApp &wxGetApp() { return *reinterpret_cast<MyApp *>(wxApp::GetInstance()); }
