<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>


<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">

<p style="color: #777777;">
<a href="https://gitlab.rtems.org/joel">Joel Sherrill</a>
commented on a
discussion on <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/803#note_135136">cpukit/libdebugger/rtems-debugger-aarch64.c</a>:
</p>
<table class="code gl-mb-5" style="border-spacing: 0; margin-bottom: 1rem; border-collapse: collapse; width: auto; font-family: monospace; font-size: 90%;" bgcolor="#ffffff" width="100%" cellpadding="0" cellspacing="0">
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="1027" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ececef; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fbfafd">
1027
</td>
<td class="new_line diff-line-num" data-linenumber="1027" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ececef; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fbfafd">
1027
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383f; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdcde;'> <span class="line" data-lang="c">  <span class="n" style="color: #333333;">memcpy</span><span class="p">(</span> <span class="o" style="font-weight: 600;">&</span><span class="kr" style="font-weight: 600;">thread</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333333;">registers</span><span class="p">[</span> <span class="n" style="color: #333333;">offset</span> <span class="p">],</span> <span class="o" style="font-weight: 600;">&</span><span class="n" style="color: #333333;">value</span><span class="p">,</span> <span class="k" style="font-weight: 600;">sizeof</span><span class="p">(</span> <span class="kt" style="color: #445588; font-weight: 600;">uint64_t</span> <span class="p">)</span> <span class="p">);</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="1028" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ececef; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fbfafd">
1028
</td>
<td class="new_line diff-line-num" data-linenumber="1028" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ececef; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fbfafd">
1028
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383f; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdcde;'> <span class="line" data-lang="c"><span class="p">}</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="1029" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ececef; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fbfafd">
1029
</td>
<td class="new_line diff-line-num" data-linenumber="1029" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ececef; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fbfafd">
1029
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383f; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdcde;'> <span class="line" data-lang="c"></span>
</pre></td>
</tr>
<tr class="line_holder old" style="line-height: 1.6;">
<td class="old_line diff-line-num old" data-linenumber="1030" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f9d7dc">
1030
</td>
<td class="new_line diff-line-num old" data-linenumber="1030" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding: inherit;" bgcolor="#fbe9eb"><pre style='display: block; font-size: 14px; color: #3a383f; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdcde;'>-<span class="line" data-lang="c"><span class="k" style="font-weight: 600;">static</span> <span class="k" style="font-weight: 600;"><span class="idiff left deletion" style="background-color: #fac5cd;">const</span></span><span class="idiff right deletion" style="background-color: #fac5cd;"> </span><span class="kt" style="color: #445588; font-weight: 600;">uint64_t</span> <span class="nf" style="color: #990000; font-weight: 600;">rtems_debugger_get_int_reg</span><span class="p">(</span></span>
</pre></td>
</tr>
<tr class="line_holder new" style="line-height: 1.6;">
<td class="old_line diff-line-num new" data-linenumber="1031" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: inherit;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="1030" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: inherit;" align="right" bgcolor="#ddfbe6">
1030
</td>
<td class="line_content new" style="padding: inherit;" bgcolor="#ecfdf0"><pre style='display: block; font-size: 14px; color: #3a383f; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdcde;'>+<span class="line" data-lang="c"><span class="k" style="font-weight: 600;">static</span> <span class="kt" style="color: #445588; font-weight: 600;">uint64_t</span> <span class="nf" style="color: #990000; font-weight: 600;">rtems_debugger_get_int_reg</span><span class="p">(</span></span>
</pre></td>
</tr>

</table>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><a href="https://gitlab.rtems.org/chris" data-reference-type="user" data-user="3" data-container="body" data-placement="top" class="gfm gfm-project_member js-user-link" title="Chris Johns" style="color: #284779; background-color: #cbe2f9; border-radius: .25rem; margin-top: 0; padding: 0 2px;">@chris</a> I got a reply quickly from the folks at LDRA with an augmented version of the example I sent.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">The quick answer is that this warning catches the presence of meaningless quallfiers which besides removing syntactic cruft is a MISRA violation</p>
<blockquote dir="auto" style="font-size: inherit; color: #626168; border-left-style: solid; margin: 0.5rem 0; padding: 0.5rem 0 0.5rem 1rem; border-color: #bfbfc3; border-width: 0 0 0 4px;" align="initial">
<p style="color: inherit; line-height: 1.5; margin: 0 0 1rem;">The warning is because the const is meaningless.  Ok, now that is out of my system.</p>
<p style="color: inherit; line-height: 1.5; margin: 0 0 1rem;">It's meaningless because the function return cannot enforce the const-ness of the return values storage. The retval only exists as a temp copy. If you don't check a return, the value just exists and dies.  it's extra chatter in our code. Which if it was not a MISRA violation, it is certainly against the spirit of the guidelines which to me say "be explicitly clear on everything and do not use conventions that obfuscate the truth."</p>
<p style="color: inherit; line-height: 1.5; margin: 0 0 1rem;">The applicable rule is:</p>
<p style="color: inherit; line-height: 1.5; margin: 0 0 1rem;">Rule 17.13 A function type shall not be type qualified (Required)</p>
<p style="color: inherit; line-height: 1.5; margin: 0 0 1rem;">The type qualifiers are const, volatile, restrict or _Atomic</p>
<p style="color: inherit; line-height: 1.5; margin: 0;">These are my notes. Left it if you find it interesting:  I think this is an lvalue, rvalue issue.  Lvalue has persistent storage. Is the stuff on the Left side of =. Rvalue is a temporary value and doesn't have to exist later, Is the stuff on the right side of the =.  A function cannot be an Lvalue. The const is immaterial because there is no persistent storage. We return to the caller and it is responsible for doing something with that return value.</p>
</blockquote>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">The example code he provided back to show more on this is <a href="https://gitlab.rtems.org/-/project/26/uploads/1a24243027e91a197d8a1c0146bdfc7b/ignored-qualifiers2.c" data-canonical-src="/uploads/1a24243027e91a197d8a1c0146bdfc7b/ignored-qualifiers2.c" data-link="true" class="gfm" style="margin-top: 0;">ignored-qualifiers2.c</a></p>
<p dir="auto" style="color: #3a383f; margin: 0;" align="initial">I would recommend you approve this MR and resolve the comment with an issue for rtems-docs to add this to our Coding Guidelines with some rationale.</p>
</div>


</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #626168;">

<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/803#note_135136">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/921104558e0888eeaccc4d99892671b3/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/803#note_135136 at 1760716414
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Merge request","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/803#note_135136"}}</script>


</p>
</div>
</body>
</html>