summaryrefslogtreecommitdiff
path: root/Mk/Features/stack_autoinit.mk
blob: 627b785b6ee055305d650c4f85c9ccb2a2593282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# The STACK_AUTOINIT feature mimics the corresponding FreeBSD basesystem feature.
#
# This enables a compiler specific option to automatically initialize
# local (automatic) variables to prevent the use of uninitialized memory.
#
# Variables that can be used:
#
# WITH_STACK_AUTOINIT		Enable for all ports.
# WITH_STACK_AUTOINIT_PORTS	Enable for specified category/port-name
# STACK_AUTOINIT_TYPE		Valid options: zero (default), pattern, uninitialized
#

.if !defined(_STACK_AUTOINIT_MK_INCLUDED)
_STACK_AUTOINIT_MK_INCLUDED=		yes
STACK_AUTOINIT_Include_MAINTAINER=	netchild@FreeBSD.org

STACK_AUTOINIT_TYPE?=	zero

.  if !defined(STATIC_AUTOINIT_UNSAFE)
CFLAGS+=	-ftrivial-auto-var-init=${STACK_AUTOINIT_TYPE}
CXXFLAGS+=	-ftrivial-auto-var-init=${STACK_AUTOINIT_TYPE}
.  endif
.endif