This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-09-28


3053. Allowing #undef likely

Section: 15.7.1  [cpp.replace.general]     Status: open     Submitter: Jakub Jelinek     Date: 2025-07-31

(From submission #734.)

P2843 moved a prohibition to #define keywords to the core language; it is now appearing in 15.7.1 [cpp.replace.general] paragraph 9:

A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 4, or to the attribute-tokens described in 9.13 [dcl.attr], except that the names likely and unlikely may be defined as function-like macros.

This allows

  #define likely(x) x
  #define unlikely(a, b) a + b

but prohibits

  #undef likely
  #undef unlikely

even though guidelines for good macro hygiene suggest to #undef a macro past its region of use.

Possible resolution:

Change in 15.7.1 [cpp.replace.general] paragraph 9 as follows:

A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 4, or to the attribute-tokens described in 9.13 [dcl.attr], except that the names likely and unlikely may be defined as function-like macros and may be undefined.