cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS
|
|
// UNSUPPORTED: system-windows
|
|
// expected-no-diagnostics
|
|
|
|
// This test reproduces the issue that previously the static analyzer
|
|
// initialized an [[no_unique_address]] empty field to zero,
|
|
// over-writing a non-empty field with the same offset.
|
|
|
|
namespace std {
|
|
#ifdef EMPTY_CLASS
|
|
|
|
struct default_delete {};
|
|
template <class _Tp, class _Dp = default_delete >
|
|
#else
|
|
// Class with methods and static members is still empty:
|
|
template <typename T>
|
|
class default_delete {
|
|
T dump();
|
|
static T x;
|
|
};
|
|
template <class _Tp, class _Dp = default_delete<_Tp> >
|
|
#endif
|
|
class unique_ptr {
|
|
[[no_unique_address]] _Tp * __ptr_;
|
|
[[no_unique_address]] _Dp __deleter_;
|
|
|
|
public:
|
|
explicit unique_ptr(_Tp* __p) noexcept
|
|
: __ptr_(__p),
|
|
__deleter_() {}
|
|
|
|
~unique_ptr() {
|
|
delete __ptr_;
|
|
}
|
|
};
|
|
}
|
|
|
|
struct X {};
|
|
|
|
int main()
|
|
{
|
|
// Previously a leak falsely reported here. It was because the
|
|
// Static Analyzer engine simulated the initialization of
|
|
// `__deleter__` incorrectly. The engine assigned zero to
|
|
// `__deleter__`--an empty record sharing offset with `__ptr__`.
|
|
// The assignment over wrote `__ptr__`.
|
|
std::unique_ptr<X> a(new X());
|
|
return 0;
|
|
}
|