[vm] Fix gcc build

This change fixes the following gcc build errors:

```
../../runtime/vm/simulator_arm.cc:1403:44: error: ‘function’ attribute directive ignored [-Werror=attributes]
 1403 |                                  int32_t r4) {
      |                                            ^
../../runtime/vm/simulator_arm.cc:1417:47: error: ‘function’ attribute directive ignored [-Werror=attributes]
 1417 |                                      double d1) {
      |                                               ^
cc1plus: note: unrecognized command-line option ‘-Wno-unused-private-field’ may have been intended to silence earlier diagnostics
cc1plus: all warnings being treated as errors
```

It looks like gcc doesn't support [[no_sanitize("function")]]
attribute, so limit its usage to clang.

TEST=ci

Change-Id: Id054970b9970dd1bf9fec78e97b4dbed5fd12c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471521
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov
2026-01-08 08:43:09 -08:00
committed by Commit Queue
parent 1cde280830
commit ff3a562acf
5 changed files with 9 additions and 7 deletions
@@ -7,8 +7,10 @@
#ifdef __clang__
#define NO_SANITIZE_UNDEFINED(check) [[clang::no_sanitize(check)]]
#define NO_SANITIZE_UNDEFINED_FUNCTION NO_SANITIZE_UNDEFINED("function")
#else
#define NO_SANITIZE_UNDEFINED(check) [[gnu::no_sanitize(check)]]
#define NO_SANITIZE_UNDEFINED_FUNCTION
#endif
#endif // RUNTIME_PLATFORM_UNDEFINED_BEHAVIOR_SANITIZER_H_