Crafter.Build/tests/IncrementalHeaderChange/fixture/main.cpp

19 lines
745 B
C++
Raw Normal View History

// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
import std;
import Widget;
extern "C" long CounterLimitInLibrary();
// Prints "<sizeof here> <sizeof in library> <count> <limit>" and exits 1 when
// the two sizes disagree. The sizes are the mixed-layout check; the count and
// the limit report which build of the library's own objects got linked in, so a
// stale implementation object or C object shows up as an old value rather than
// as silence.
int main() {
std::size_t here = sizeof(Widget);
std::size_t inLibrary = WidgetSizeInLibrary();
std::print("{} {} {} {}", here, inLibrary, WidgetCountInLibrary(), CounterLimitInLibrary());
return here == inLibrary ? 0 : 1;
}