commonmark / cmark

CommonMark parsing and rendering library and program in C
Other
1.6k stars 527 forks source link

remove check for `__builtin_expect` #508

Closed compnerd closed 6 months ago

compnerd commented 6 months ago

Use __has_builtin to check at compile time if the feature is supported. This macro is supported by both clang and GCC (as of 10). GCC 10 was released ~2020 [1], which is ~4 years old now. In the case that the compiler in use is not new enough, we still provide the fallback so that the code will compile but without the additional hints for the branch probability (which also tends to be accounted for by modern branch predictors). This removes the final use of the config.h header and the configure time checks. Remove the use of config.h from the code base.

[1] https://gcc.gnu.org/releases.html