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 11 COPTS.pf.c+= ${CC_WNO_IMPLICIT_FALLTHROUGH} 12 COPTS.radeon_cs.c+= ${CC_WNO_IMPLICIT_FALLTHROUGH} 13 COPTS.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") 17 COPTS.linux_machdep.c+= -Wno-error=unused-but-set-variable 18 .endif 19 20 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 10 && ${ACTIVE_CC} == "gcc" 21 COPTS.ath.c+= -Wno-error=enum-conversion 22 COPTS.dpt.c+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 23 COPTS.ffs_appleufs.c+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 24 # These are wrong. The code explicitly avoids this case. 25 COPTS.in_pcb.c+= ${CC_WNO_RETURN_LOCAL_ADDR} 26 COPTS.in6_pcb.c+= ${CC_WNO_RETURN_LOCAL_ADDR} 27 # Also seems wrong. 28 COPTS.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") 35 COPTS.aes_armv8.c+= ${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW} 36 COPTS.aes_neon.c+= ${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW} -flax-vector-conversions 37 COPTS.aes_neon_subr.c+= ${CC_WNO_ARRAY_BOUNDS} -flax-vector-conversions 38 COPTS.chacha_neon.c+= -flax-vector-conversions 39 .endif 40 41 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" 42 COPTS.aes_ni.c+= ${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW} 43 COPTS.aes_sse2_subr.c+= ${CC_WNO_ARRAY_BOUNDS} 44 COPTS.aes_ssse3_subr.c+=${CC_WNO_ARRAY_BOUNDS} 45 COPTS.aes_via.c+= ${CC_WNO_ARRAY_BOUNDS} 46 .endif 47 48 .endif 49