<div dir="ltr">The macros defined in sanitizer/asan_interface.h and in our header are the same. For consistency I just re-defined them. When the header is available, since it looks like the macros have been there for a long time, we can just skip redefining it and use them directly. I'll add a comment.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 10, 2023 at 9:09 AM Ioi Lam <<a href="mailto:iklam@openjdk.org">iklam@openjdk.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, 9 Jan 2023 15:48:48 GMT, Justin King <<a href="mailto:jcking@openjdk.org" target="_blank">jcking@openjdk.org</a>> wrote:<br>
<br>
>> I like this, but would compilers not complain about unused statements?<br>
><br>
> I don't believe so, at least not based on current options. Other projects use similar tricks, like ABSL_DCHECK from Abseil which short circuits expressions when in non-debug builds causing the code to be unreachable and stripped. If it does, we can always just remove the if statement part and have it evaluate anyway. Most compilers should realize that the statements are unused and should be pruned.<br>
<br>
The macros `ASAN_POISON_MEMORY_REGION` and `ASAN_UNPOISON_MEMORY_REGION` are already defined in [sanitizer/asan_interface.h](<a href="https://opensource.apple.com/source/clang/clang-700.1.81/src/projects/compiler-rt/include/sanitizer/asan_interface.h.auto.html" rel="noreferrer" target="_blank">https://opensource.apple.com/source/clang/clang-700.1.81/src/projects/compiler-rt/include/sanitizer/asan_interface.h.auto.html</a>), but we redefine them here. <br>
<br>
Since ASan is going to be an obscured feature for many HotSpot developers, I don't think we should make it more obscured.<br>
<br>
I think it's better to declare our own macros that call into the existing macros. Maybe something like <br>
`_ASAN_POISON_MEMORY_REGION`. The comments should be improved to say why we do this (to prevent people that don't use ASan from breaking ASan).<br>
<br>
-------------<br>
<br>
PR: <a href="https://git.openjdk.org/jdk/pull/11702" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/11702</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span><br><table border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:20px 0px 0px;font-family:"Times New Roman""><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td valign="top" style="padding:0px 20px 0px 0px;vertical-align:top;border-right:1px solid rgb(213,213,213)"><img src="https://www.gstatic.com/images/branding/product/1x/googleg_64dp.png" alt="Google Logo" width="72" style="margin: 0px; padding: 0px; display: block; height: auto;"></td><td style="padding:0px 0px 0px 20px"><table border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:0px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td colspan="2" style="padding:1px 0px 5px;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:13px;line-height:13px;color:rgb(56,58,53);font-weight:700">Justin King</td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="padding:0px 0px 5px;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:11px;line-height:13px;color:rgb(56,58,53)">Software Engineer</td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="padding:0px 0px 5px;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:11px;line-height:13px;color:rgb(56,58,53)"><a href="mailto:jcking@google.com" target="_blank">jcking@google.com</a></td></tr></tbody></table></td></tr></tbody></table><table style="border:none;border-collapse:collapse"><colgroup><col width="85"><col width="539"></colgroup><tbody><tr style="height:0pt"><td style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255);vertical-align:middle;padding:4.32pt"></td><td style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255);vertical-align:middle;padding:4.32pt"><br></td></tr></tbody></table></span></div></div>