[Mesa-dev] [Bug 107439] mesa defines likely/unlikely and these are C++20 keywords

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Jul 31 23:47:36 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=107439

            Bug ID: 107439
           Summary: mesa defines likely/unlikely and these are C++20
                    keywords
           Product: Mesa
           Version: git
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: brucedawson at chromium.org
        QA Contact: mesa-dev at lists.freedesktop.org

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.
https://en.cppreference.com/w/cpp/language/attributes/likely

This means that a conforming C++20 implementation may reject code that includes
mesa's util/macros.h:
https://cgit.freedesktop.org/mesa/mesa/tree/src/util/macros.h#n50

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180731/1aba20bd/attachment.html>


More information about the mesa-dev mailing list