mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
MINOR: debug: add a new DISGUISE() macro to pass a value as identity
This does exactly the same as ALREADY_CHECKED() but does it inline, returning an identical copy of the scalar variable without letting the compiler know how it might have been transformed. This can forcefully disable certain null-pointer checks or result checks when known undesirable. Typically forcing a crash with *(DISGUISE(NULL))=0 will not cause a null-deref warning.
This commit is contained in:
parent
663825e5d0
commit
f401668306
1 changed files with 5 additions and 0 deletions
|
|
@ -77,6 +77,11 @@
|
|||
*/
|
||||
#define ALREADY_CHECKED(p) do { asm("" : "=rm"(p) : "0"(p)); } while (0)
|
||||
|
||||
/* same as above but to be used to pass the input value to the output but
|
||||
* without letting the compiler know about its initial properties.
|
||||
*/
|
||||
#define DISGUISE(v) ({ typeof(v) __v = (v); ALREADY_CHECKED(__v); __v; })
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue