<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>On 2024-10-07 16:45, Baesken, Matthias wrote:</p>
<blockquote type="cite" cite="mid:AM9PR02MB6770991FBEFF735CBD12B8F4937D2@AM9PR02MB6770.eurprd02.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi, I came across some
warnings as errors today when trying to build on Linux with
toolchain clang (clang 15 on USE Linux) :
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">jdk/src/jdk.jpackage/share/native/common/Log.cpp:46:28:
error: unused variable 'defaultLogLevel'
[-Werror,-Wunused-const-variable]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> const
Logger::LogLevel defaultLogLevel = Logger::LOG_TRACE;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">jdk/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c:359:11:
error: variable 'rslt' set but not used
[-Werror,-Wunused-but-set-variable]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> int rslt;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Should we adjust the
coding ?</span></p>
</div>
</blockquote>
<p>I'd say this sounds like the first hand choice: If the compiler
is indeed correct and this is dead code, remove it!</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:AM9PR02MB6770991FBEFF735CBD12B8F4937D2@AM9PR02MB6770.eurprd02.prod.outlook.com">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Or somehow silence /
remove this warning ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I wonder where this
comes from, last time I built with clang on Linux I did not
see those …</span></p>
</div>
</blockquote>
<p><br>
</p>
<p>Unused code warnings in the JDK code base typically appears only
for debug or release builds, or some other #ifdef guards.</p>
<p>Neither Oracle CI nor GHA builds with clang on Linux on a regular
basis. I don't know if anyone else is doing it either. So that
combination typically bitrots over time.<br>
</p>
<p>/Magnus<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:AM9PR02MB6770991FBEFF735CBD12B8F4937D2@AM9PR02MB6770.eurprd02.prod.outlook.com">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards, Matthias<o:p></o:p></span></p>
</div>
</blockquote>
</body>
</html>