diff mbox

What CPP macro should -fsanitize=address define?

Message ID CAMe9rOomdMMe7i9DVZ-QRAXDTjpZjGUKpQZJ8FmGXOHXRqoF+g@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Nov. 21, 2012, 8:21 p.m. UTC
On Wed, Nov 21, 2012 at 12:12 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Nov 21, 2012 at 11:25:35AM -0800, H.J. Lu wrote:
>> 2012-11-21  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       PR c/55397
>>       * cppbuiltin.c (define_builtin_macros_for_compilation_flags):
>>       Define __SANITIZE_ADDRESS__ for flag_asan.
>
> Ok, thanks.
>
>> --- a/gcc/cppbuiltin.c
>> +++ b/gcc/cppbuiltin.c
>> @@ -91,6 +91,9 @@ define_builtin_macros_for_compilation_flags
>> (cpp_reader *pfile)
>>        cpp_define_formatted (pfile, "__PIE__=%d", flag_pie);
>>      }
>>
>> +  if (flag_asan)
>> +    cpp_define (pfile, "__SANITIZE_ADDRESS__");
>> +
>>    if (optimize_size)
>>      cpp_define (pfile, "__OPTIMIZE_SIZE__");
>>    if (optimize)
>
>         Jakub

Here is a doc patch.  OK to install?

Thanks.

Comments

Jakub Jelinek Nov. 21, 2012, 8:24 p.m. UTC | #1
On Wed, Nov 21, 2012 at 12:21:55PM -0800, H.J. Lu wrote:
> Here is a doc patch.  OK to install?

Yes.

> 2012-11-21  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* doc/cpp.texi: Document __SANITIZE_ADDRESS__.
> 
> diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
> index c463e7c..682ee9f 100644
> --- a/gcc/doc/cpp.texi
> +++ b/gcc/doc/cpp.texi
> @@ -2352,6 +2352,10 @@ use.
>  This macro is defined, with value 2, when @option{-fstack-protector-all} is
>  in use.
> 
> +@item __SANITIZE_ADDRESS__
> +This macro is defined, with value 1, when @option{-fsanitize=address} is
> +in use.
> +
>  @item __TIMESTAMP__
>  This macro expands to a string constant that describes the date and time
>  of the last modification of the current source file. The string constant

	Jakub
diff mbox

Patch

diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index c463e7c..682ee9f 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -2352,6 +2352,10 @@  use.
 This macro is defined, with value 2, when @option{-fstack-protector-all} is
 in use.

+@item __SANITIZE_ADDRESS__
+This macro is defined, with value 1, when @option{-fsanitize=address} is
+in use.
+
 @item __TIMESTAMP__
 This macro expands to a string constant that describes the date and time
 of the last modification of the current source file. The string constant