Improve compiler detection for pragma directives
Compiling with clang 17 I get a couple of warnings due to the #pragma GCC
directives, because checking for __GNUC__
is not enough to distinguish between GCC and clang (clang also defines it, see https://stackoverflow.com/a/55926503) so I added a check for that in most cases. In the second commit I remove it for some unit tests, since it seems using some deprecated methods is the intended way. I also removed one case of pragmas for GCC 9 and older which is too old now.
EDIT: In the end I only changed the file that gives a warning since #pragma GCC
works that way with Clang too. Compiler detection is still done inconsistently but I'm not sure it is worth it the time to change it if it works for both GCC and Clang. In addition, the checks for the value of __GNUC__
give unexpected results, 14 for GCC 14 but 4 for Clang 18: https://godbolt.org/z/Kh5zhvjqo