mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
Everywhere: Add Clang pragmas
We use these to prevent UB from being optimized away in `/bin/crash` and to make the compiler not warn about the many implicit floating point type promotions in LibM.
This commit is contained in:
parent
98a9a1d7f9
commit
e8e628de57
2 changed files with 14 additions and 1 deletions
|
@ -14,6 +14,11 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||||
|
#endif
|
||||||
|
|
||||||
template<size_t>
|
template<size_t>
|
||||||
constexpr double e_to_power();
|
constexpr double e_to_power();
|
||||||
template<>
|
template<>
|
||||||
|
@ -1461,3 +1466,7 @@ float nearbyintf(float value) NOEXCEPT
|
||||||
return internal_to_integer(value, RoundingMode { fegetround() });
|
return internal_to_integer(value, RoundingMode { fegetround() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
|
@ -21,7 +21,11 @@
|
||||||
|
|
||||||
using Test::Crash;
|
using Test::Crash;
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
# pragma clang optimize off
|
||||||
|
#else
|
||||||
# pragma GCC optimize("O0")
|
# pragma GCC optimize("O0")
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue