This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] BZ #13979- A warning should be issued if FORTIFY_SOURCE isrequested but not enabled
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Andreas Jaeger <aj at suse dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 7 May 2012 14:15:01 -0700 (PDT)
- Subject: Re: [PATCH] BZ #13979- A warning should be issued if FORTIFY_SOURCE isrequested but not enabled
- References: <4FA83974.email@example.com>
> * include/features.h: Warn if user requests FORTIFY_SOURCE checking
> but the checks are disabled for any reason.
Use the correct name in the log: _FORTIFY_SOURCE.
> +#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 && __USE_FORTIFY_LEVEL == 0
> +# warning _FORTIFY_SOURCE requested but disabled
It's probably more helpful to say something specific:
# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
# elif !__GNUC_PREREQ (4, 1)
# warning _FORTIFY_SOURCE is only supported with GCC 4.1 or later
# warning _FORTIFY_SOURCE is not available for mysterious reasons
It also seems cleaner to move this into the #if nest that actually sets
__USE_FORTIFY_LEVEL, perhaps reorganizing that a little as needed.