This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] BZ #13979- A warning should be issued if FORTIFY_SOURCE isrequested but not enabled


> 	* 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
> +#endif

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
# else
#  warning _FORTIFY_SOURCE is not available for mysterious reasons
# endif

It also seems cleaner to move this into the #if nest that actually sets
__USE_FORTIFY_LEVEL, perhaps reorganizing that a little as needed.


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]