]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compiler: add a simple macro to concatenate resolved strings
authorWilly Tarreau <w@1wt.eu>
Wed, 12 Mar 2025 17:06:55 +0000 (18:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Mar 2025 17:06:55 +0000 (18:06 +0100)
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

index ced25b229cf65842deb5cb2aa93c8bc145e0b8c8..de55fe95bf8cbaa68989ddae0cb39669f6a52a96 100644 (file)
 #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