Clang-tidy has a check to prohibit identifiers that are reserved for the
compiler. Those are identifiers that start with:
- an underscore plus an uppercase letter
- two underscores
- an underscore, and are in the global scope
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/reserved-identifier.html
Many public GLib macros define variables starting with two underscores,
which is technically not allowed. This is probably usually harmless, but
it causes false positives in the abovementioned clang-tidy check when
consumers of GLib use macros like G_VALUE_HOLDS_POINTER or
g_str_has_suffix.
This commit replaces all such names with one-underscore names, which are
not reserved because they're not in the global scope.
Here's the incantation I used to discover which macros needed editing:
git grep -P '\b__(?!builtin|atomic|sync|asm|volatile|pragma)[a-z].*\\$' \
-- '*.h' | grep -v valgrind.h
This generates a manageable number of false positives. It also fails to
find identifiers on the last line of a macro, but those are generally
already mentioned elsewhere in the macro.
I left valgrind.h untouched.