<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - mesa defines likely/unlikely and these are C++20 keywords"
href="https://bugs.freedesktop.org/show_bug.cgi?id=107439">107439</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>mesa defines likely/unlikely and these are C++20 keywords
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>git
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Mesa core
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>brucedawson@chromium.org
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>In util/macros.h mesa #defines likely and unlikely. This used to be a
reasonable and legal thing to do but with the advent of C++20 this is no longer
legal.
C++20 treats likely and unlikely as reserved keywords for use as attributes.
<a href="https://en.cppreference.com/w/cpp/language/attributes/likely">https://en.cppreference.com/w/cpp/language/attributes/likely</a>
This means that a conforming C++20 implementation may reject code that includes
mesa's util/macros.h:
<a href="https://cgit.freedesktop.org/mesa/mesa/tree/src/util/macros.h#n50">https://cgit.freedesktop.org/mesa/mesa/tree/src/util/macros.h#n50</a>
The concrete manifestation of this problem is that future versions of VC++
(unknown release date) will treat definitions of likely and unlikely as hard
errors. These errors can temporarily be avoided by using _ALLOW_KEYWORD_MACROS
but that is clearly a temporary hack.
So, mesa should switch from likely/unlikely to LIKELY/UNLIKELY or some other
variant.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>