From bb4addabb742f2305ad6667ed42ebb12f5df2af3 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 12 Mar 2025 18:06:55 +0100 Subject: [PATCH] MINOR: compiler: add a simple macro to concatenate resolved strings It's often useful to be able to concatenate strings after resolving them (e.g. __FILE__, __LINE__ etc). Let's just have a CONCAT() macro to do that, which calls _CONCAT() with the same arguments to make sure the contents are resolved before being concatenated. --- include/haproxy/compiler.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h index ced25b229c..de55fe95bf 100644 --- a/include/haproxy/compiler.h +++ b/include/haproxy/compiler.h @@ -283,6 +283,10 @@ #define _TOSTR(x) #x #define TOSTR(x) _TOSTR(x) +/* concatenates the two strings after resolving possible macros */ +#define _CONCAT(a,b) a ## b +#define CONCAT(a,b) _CONCAT(a,b) + /* * Gcc >= 3 provides the ability for the program to give hints to the * compiler about what branch of an if is most likely to be taken. This -- 2.39.5