From f50da2c32017a59ef40f96fdcb50f8a9e8d8be44 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 5 May 2022 19:43:49 +0200 Subject: [PATCH] BUILD: applet: mark the CLI's generic variables as deprecated The generic context variables p0/p1/p2, i0/i1, o0/o1 have been abused and causing trouble for too long, it's time to remove them now that they are not used anymore. However the risk that external code still uses them is not nul and we had not warned before about their removal. Let's mark them deprecated in 2.6 and removed in 2.7. This will let external code continue to work (as well as it could if it misuses them), with a strong encouragement on updating it. If you found this commit after a bisect session you initiated to figure why you got some build warnings and don't know what to do, have a look at the code that deals with the "show fd", "show env" or "show servers" commands, as it's supposed to be self-explanatory about the tiny changes to apply to your code to port it. If you find APPLET_MAX_SVCCTX to be too small for your use case, either kindly ask for a tiny extension (and try to get your code merged), or just use a pool. --- include/haproxy/applet-t.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h index ccedad0d6..af9560ad6 100644 --- a/include/haproxy/applet-t.h +++ b/include/haproxy/applet-t.h @@ -115,9 +115,14 @@ struct appctx { const char *msg; /* pointer to a persistent message to be returned in CLI_ST_PRINT state */ int severity; /* severity of the message to be returned according to (syslog) rfc5424 */ char *err; /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_FREE state */ - void *p0, *p1, *p2; /* ...registered commands, initialized to 0 by the CLI before first... */ - size_t o0, o1; /* ...invocation of the keyword parser, except for the list element which... */ - int i0, i1; /* ...is initialized with LIST_INIT(). */ + /* WARNING: the entries below are only kept for compatibility + * with possible external code but will disappear in 2.7, you + * must use the cleaner svcctx now (look at "show fd" for an + * example). + */ + __attribute__((deprecated)) void *p0, *p1, *p2; + __attribute__((deprecated)) size_t o0, o1; + __attribute__((deprecated)) int i0, i1; } cli; /* context used by the CLI */ struct { struct cache_entry *entry; /* Entry to be sent from cache. */