Skip to content

Clang 24 now gives a build error if a function is marked with both - #11011

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_966819582
Aug 18, 2026
Merged

Clang 24 now gives a build error if a function is marked with both#11011
copybara-service[bot] merged 1 commit into
masterfrom
test_966819582

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Clang 24 now gives a build error if a function is marked with both
always_inline and noinline at the same time.

In XNNPACK, helper functions that perform out-of-bounds reads use
XNN_OOB_READS to disable sanitizers (ASAN, MSAN, TSAN, HWASAN).
To stop Clang from dropping those sanitizer attributes during inlining,
XNN_OOB_READS adds noinline. However, because these functions are declared
with XNN_INLINE, they also got always_inline, causing Clang 24 to fail.

This change fixes the build:

  • Added XNN_HAS_OOB_READS_SANITIZER in src/xnnpack/common.h to check if
    ASAN, MSAN, TSAN, or HWASAN is turned on.
  • When a sanitizer is running, XNN_INLINE drops always_inline (using plain
    inline instead).
  • In normal builds without sanitizers, XNN_INLINE keeps always_inline for
    fast runtime performance.

always_inline and noinline at the same time.

In XNNPACK, helper functions that perform out-of-bounds reads use
XNN_OOB_READS to disable sanitizers (ASAN, MSAN, TSAN, HWASAN).
To stop Clang from dropping those sanitizer attributes during inlining,
XNN_OOB_READS adds noinline. However, because these functions are declared
with XNN_INLINE, they also got always_inline, causing Clang 24 to fail.

This change fixes the build:
- Added XNN_HAS_OOB_READS_SANITIZER in src/xnnpack/common.h to check if
  ASAN, MSAN, TSAN, or HWASAN is turned on.
- When a sanitizer is running, XNN_INLINE drops always_inline (using plain
  inline instead).
- In normal builds without sanitizers, XNN_INLINE keeps always_inline for
  fast runtime performance.

PiperOrigin-RevId: 966832986
@copybara-service
copybara-service Bot merged commit fe6fe52 into master Aug 18, 2026
25 checks passed
@copybara-service
copybara-service Bot deleted the test_966819582 branch August 18, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant