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@lists.freedesktop.org
          Reporter: brucedaw...@chromium.org
        QA Contact: mesa-dev@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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to