summaryrefslogtreecommitdiffhomepage
path: root/auto/have
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2024-02-29 15:32:00 +0000
committerAndrew Clayton <a.clayton@nginx.com>2024-03-09 00:42:27 +0000
commit0b5223e1cda35addb1e3e1b8a6d0601b2ee9bab6 (patch)
tree928ada6dbe97b91a03a4759de03d9dd095963e42 /auto/have
parent1dcb5383319a2e41969234d838a20f6a4316334e (diff)
downloadunit-0b5223e1cda35addb1e3e1b8a6d0601b2ee9bab6.tar.gz
unit-0b5223e1cda35addb1e3e1b8a6d0601b2ee9bab6.tar.bz2
Disable strict-aliasing in clang by default
Aliasing is essentially when you access the same memory via different types. If the compiler knows this doesn't happen it can make some optimisations. There is however code in Unit, for example in the wasm language module and the websocket code that may fall foul of strict-aliasing rules. (For the wasm module I explicitly disable it there) In auto/cc/test for GCC we have NXT_CFLAGS="$NXT_CFLAGS -O" ... # -O2 enables -fstrict-aliasing and -fstrict-overflow. #NXT_CFLAGS="$NXT_CFLAGS -O2" #NXT_CFLAGS="$NXT_CFLAGS -Wno-strict-aliasing" So with GCC by default we effectively compile with -fno-strict-aliasing. For clang we have this NXT_CFLAGS="$NXT_CFLAGS -O" ... #NXT_CFLAGS="$NXT_CFLAGS -O2" ... NXT_CFLAGS="$NXT_CFLAGS -fstrict-aliasing" (In _clang_, -fstrict-aliasing is always enabled by default) So in clang we always build with -fstrict-aliasing. I don't think this is the best idea, building with something as fundamental as this disabled in one compiler and enabled in another. This patch adjusts the Clang side of things to match that of GCC. I.e compile with -fno-strict-aliasing. It also explicitly sets -fno-strict-aliasing for GCC, which is what we were getting anyway but lets be explicit about it. Cc: Dan Callahan <d.callahan@f5.com> Reviewed-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'auto/have')
0 files changed, 0 insertions, 0 deletions