Home | History | Annotate | Line # | Download | only in misc
Makefile revision 1.11
      1 # $NetBSD: Makefile,v 1.11 2025/11/21 12:20:50 nia Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 TESTSDIR=	${TESTSBASE}/lib/libc/misc
      6 
      7 TESTS_C+=	t_ubsan
      8 TESTS_CXX+=	t_ubsanxx
      9 
     10 .if ${MACHINE_ARCH} == "sparc64"
     11 TESTS_C+=	t_vis
     12 .if ${ACTIVE_CC} == "gcc"
     13 COPTS.t_vis.c+=	-mvis
     14 .endif
     15 .endif
     16 
     17 .PATH:		${NETBSDSRCDIR}/common/lib/libc/misc
     18 SRCS.t_ubsan=	t_ubsan.c
     19 SRCS.t_ubsanxx=	t_ubsanxx.cpp
     20 
     21 .if ${MKSANITIZER:Uno} != "yes" && ${MKLIBCSANITIZER:Uno} != "yes"
     22 # These tests are designed to be used against micro-UBSan only.
     23 # micro-UBSan is used in these tests as a standalone library only.
     24 CPPFLAGS+=		-DENABLE_TESTS
     25 SRCS.t_ubsan+=		ubsan.c
     26 SRCS.t_ubsanxx+=	ubsan.c
     27 UBSAN_FLAGS=		-fsanitize=undefined
     28 UBSAN_FLAGS+=		${${ACTIVE_CC} == "clang" :? -fsanitize=integer :}
     29 UBSAN_FLAGS+=		${${ACTIVE_CC} == "clang" :? -fsanitize=nullability :}
     30 CFLAGS+=		${UBSAN_FLAGS}
     31 CXXFLAGS+=		${UBSAN_FLAGS}
     32 CWARNFLAGS+=		-Wno-return-type -Wno-strict-aliasing
     33 CWARNFLAGS.clang+=	-Wno-incompatible-pointer-types-discards-qualifiers
     34 CWARNFLAGS.clang+=	-Wno-nullability-completeness 
     35 .endif
     36 COPTS.t_ubsan.c += -Wno-stack-protector
     37 COPTS.t_ubsanxx.cpp += -Wno-stack-protector
     38 COPTS.ubsan.c+=    ${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":? -O0 :}
     39 
     40 COPTS.t_ubsan.c+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-int-in-bool-context :}
     41 COPTS.t_ubsanxx.cpp+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-int-in-bool-context :}
     42 COPTS.t_ubsan.c+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-uninitialized :}
     43 COPTS.t_ubsanxx.cpp+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-uninitialized :}
     44 
     45 COPTS.ubsan.c+=    	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-builtin-declaration-mismatch :}
     46 
     47 .include <bsd.test.mk>
     48