|
26 | 26 | // - register_path(path, ptr) -> exact match (does NOT match a longer URL) |
27 | 27 | // - register_prefix(path, ptr) -> prefix match (matches the path and all |
28 | 28 | // children of it) |
29 | | -// - register_resource(path, ptr) is kept as a [[deprecated]] alias for |
30 | | -// register_path so TASK-023-era call sites still compile. |
31 | | -// - The 3-arg `bool family` overloads of register_resource are gone. |
| 29 | +// - register_resource is gone entirely (clean break): neither the |
| 30 | +// smart-pointer overloads nor the 3-arg `bool family` overloads exist. |
| 31 | +// Call register_path for exact match or register_prefix for prefix. |
32 | 32 | // |
33 | 33 | // This TU pins both the compile-time signature contract (the new methods |
34 | 34 | // exist with the right shape; the bool-family overload is removed) and |
@@ -150,36 +150,35 @@ static_assert(std::is_same_v< |
150 | 150 | void>, |
151 | 151 | "unregister_prefix(const string&) must exist and return void"); |
152 | 152 |
|
153 | | -// (6) Negative SFINAE: the 3-arg bool-family overload of register_resource |
154 | | -// must be gone. (Acceptance criterion #1 of TASK-024 pinned at compile |
155 | | -// time.) The probe expression is a call with a trailing `bool` arg; if |
156 | | -// such an overload existed, the call would be well-formed and ::value |
157 | | -// would flip to true. |
| 153 | +// (6) Negative SFINAE: register_resource is removed entirely (clean break). |
| 154 | +// None of its historical shapes may exist — the templated unique_ptr |
| 155 | +// overload, the shared_ptr overload, or the 3-arg bool-family overloads. |
| 156 | +// The probe covers the smart-pointer shapes (the templated/typed |
| 157 | +// overloads); if any survived, the call would be well-formed and |
| 158 | +// ::value would flip to true. Callers use register_path / register_prefix. |
158 | 159 | template <typename, typename = void> |
159 | | -struct has_bool_family_register : std::false_type {}; |
| 160 | +struct has_register_resource_shared : std::false_type {}; |
160 | 161 |
|
161 | 162 | template <typename WS> |
162 | | -struct has_bool_family_register<WS, std::void_t< |
| 163 | +struct has_register_resource_shared<WS, std::void_t< |
163 | 164 | decltype(std::declval<WS&>().register_resource( |
164 | 165 | std::declval<const std::string&>(), |
165 | | - std::declval<std::shared_ptr<http_resource>>(), |
166 | | - std::declval<bool>()))>> : std::true_type {}; |
| 166 | + std::declval<std::shared_ptr<http_resource>>()))>> : std::true_type {}; |
167 | 167 |
|
168 | | -static_assert(!has_bool_family_register<webserver>::value, |
169 | | - "the bool-family register_resource overload must be removed"); |
| 168 | +static_assert(!has_register_resource_shared<webserver>::value, |
| 169 | + "register_resource(const string&, shared_ptr) must be removed"); |
170 | 170 |
|
171 | 171 | template <typename, typename = void> |
172 | | -struct has_bool_family_register_unique : std::false_type {}; |
| 172 | +struct has_register_resource_unique : std::false_type {}; |
173 | 173 |
|
174 | 174 | template <typename WS> |
175 | | -struct has_bool_family_register_unique<WS, std::void_t< |
| 175 | +struct has_register_resource_unique<WS, std::void_t< |
176 | 176 | decltype(std::declval<WS&>().register_resource( |
177 | 177 | std::declval<const std::string&>(), |
178 | | - std::declval<std::unique_ptr<http_resource>>(), |
179 | | - std::declval<bool>()))>> : std::true_type {}; |
| 178 | + std::declval<std::unique_ptr<http_resource>>()))>> : std::true_type {}; |
180 | 179 |
|
181 | | -static_assert(!has_bool_family_register_unique<webserver>::value, |
182 | | - "the bool-family register_resource unique_ptr overload must be removed"); |
| 180 | +static_assert(!has_register_resource_unique<webserver>::value, |
| 181 | + "register_resource(const string&, unique_ptr) must be removed"); |
183 | 182 |
|
184 | 183 | // ---- Runtime behaviour tests ------------------------------------------- |
185 | 184 |
|
@@ -292,26 +291,6 @@ LT_BEGIN_AUTO_TEST(webserver_register_path_prefix_suite, |
292 | 291 | ws.stop(); |
293 | 292 | LT_END_AUTO_TEST(unregister_resource_alias_handles_both_kinds) |
294 | 293 |
|
295 | | -// The deprecated register_resource(path, ptr) forwarder must still compile |
296 | | -// and behave like register_path (exact match, no longer-URL match). |
297 | | -// Suppress the deprecation warning locally so the test binary still |
298 | | -// builds with -Werror. |
299 | | -LT_BEGIN_AUTO_TEST(webserver_register_path_prefix_suite, |
300 | | - register_resource_deprecated_forwarder_behaves_like_register_path) |
301 | | - webserver ws{create_webserver(PORT + 6)}; |
302 | | -#pragma GCC diagnostic push |
303 | | -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
304 | | - ws.register_resource("/d", std::make_shared<ok_resource>()); |
305 | | -#pragma GCC diagnostic pop |
306 | | - ws.start(false); |
307 | | - |
308 | | - LT_CHECK_EQ(fetch("localhost:8186/d").response_code, 200); |
309 | | - // Exact-match behaviour: a longer URL must 404. |
310 | | - LT_CHECK_EQ(fetch("localhost:8186/d/extra").response_code, 404); |
311 | | - |
312 | | - ws.stop(); |
313 | | -LT_END_AUTO_TEST(register_resource_deprecated_forwarder_behaves_like_register_path) |
314 | | - |
315 | 294 | // TASK-056: registering the SAME path as both exact and prefix is no |
316 | 295 | // longer permitted (the (method, path) cache key cannot discriminate |
317 | 296 | // the two kinds at lookup time, so the second call now throws |
@@ -525,9 +504,9 @@ LT_END_AUTO_TEST(register_prefix_unique_ptr_transfers_ownership_and_serves) |
525 | 504 |
|
526 | 505 | // ---- Error-path tests for register_prefix (findings 9 / 32) ------------- |
527 | 506 | // |
528 | | -// register_resource (deprecated alias) is tested for null / duplicate in |
| 507 | +// register_path is tested for null / duplicate in |
529 | 508 | // webserver_register_smartptr_test.cpp. The tests below pin the same |
530 | | -// invariants on the new register_prefix API surface so this TU is |
| 509 | +// invariants on the register_prefix API surface so this TU is |
531 | 510 | // self-contained. |
532 | 511 |
|
533 | 512 | LT_BEGIN_AUTO_TEST(webserver_register_path_prefix_suite, |
|
0 commit comments