1# $NetBSD: copts.mk,v 1.12 2024/07/04 01:11:34 rin Exp $ 2 3# MI per-file compiler options required. 4 5# Use -Wno-error=foo when the ultimate goal is to fix this warning 6# with code change, and use -Wno-foo when the warning is bad. 7 8.ifndef _SYS_CONF_COPTS_MK_ 9_SYS_CONF_COPTS_MK_=1 10 11COPTS.pf.c+= ${CC_WNO_IMPLICIT_FALLTHROUGH} 12COPTS.radeon_cs.c+= ${CC_WNO_IMPLICIT_FALLTHROUGH} 13COPTS.via_dmablit.c+= ${CC_WNO_IMPLICIT_FALLTHROUGH} 14 15.if defined(HAVE_GCC) && ${HAVE_GCC} >= 8 && ${ACTIVE_CC} == "gcc" && \ 16 (${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel") 17COPTS.linux_machdep.c+= -Wno-error=unused-but-set-variable 18.endif 19 20.if defined(HAVE_GCC) && ${HAVE_GCC} >= 10 && ${ACTIVE_CC} == "gcc" 21COPTS.ath.c+= -Wno-error=enum-conversion 22COPTS.dpt.c+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 23COPTS.ffs_appleufs.c+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 24# These are wrong. The code explicitly avoids this case. 25COPTS.in_pcb.c+= ${CC_WNO_RETURN_LOCAL_ADDR} 26COPTS.in6_pcb.c+= ${CC_WNO_RETURN_LOCAL_ADDR} 27# Also seems wrong. 28COPTS.magma.c+= ${CC_WNO_MAYBE_UNINITIALIZED} 29.endif 30 31# Some of these indicate a potential GCC bug: 32# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110878 33.if defined(HAVE_GCC) && ${HAVE_GCC} >= 12 && ${ACTIVE_CC} == "gcc" && \ 34 (${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "aarch64eb") 35COPTS.aes_armv8.c+= ${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW} 36COPTS.aes_neon.c+= ${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW} -flax-vector-conversions 37COPTS.aes_neon_subr.c+= ${CC_WNO_ARRAY_BOUNDS} -flax-vector-conversions 38COPTS.chacha_neon.c+= -flax-vector-conversions 39.endif 40 41.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" 42COPTS.aes_ni.c+= ${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW} 43COPTS.aes_sse2_subr.c+= ${CC_WNO_ARRAY_BOUNDS} 44COPTS.aes_ssse3_subr.c+=${CC_WNO_ARRAY_BOUNDS} 45COPTS.aes_via.c+= ${CC_WNO_ARRAY_BOUNDS} 46.endif 47 48.endif 49