This question is about C++20\'s [[likely]]/[[unlikely]] feature, not compiler-defined macros.
This documents (cppreference) only gave an ex
As of today, cppreference states that, for example, likely (emphasis mine):
Applies to a statement to allow the compiler to optimize for the case where paths of execution including that statement are more likely than any alternative path of execution that does not include such a statement.
That suggests that the place to put the attribute is in the statement that is most likely, i.e.:
if (condition) { [[likely]] ... } else { ... }
This syntax is accepted, for example, by Visual Studio 2019 16.7.0 when compiling with /std:c++latest.