llvm-project/clang/test/SemaCXX/attr-target-mv-warn-unused.cpp
Fangrui Song 1d0f86ba80
[Sema] Warn unused functions for FMV based on the target attribute (#81302)
The spurious -Wunused-function warning issue for `target_version` #80227
also applied to `__attribute__((target(...)))` based FMV. #81167 removed
warnings for all `target`-based FMV. This patch restores the warnings
for `__attribute__((target("default")))`.
2024-02-09 13:39:08 -08:00

17 lines
648 B
C++

// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify -Wunused %s
__attribute__((target("sse3")))
static int not_used_fmv() { return 1; }
__attribute__((target("avx2")))
static int not_used_fmv() { return 2; }
__attribute__((target("default")))
static int not_used_fmv() { return 0; } // expected-warning {{unused function 'not_used_fmv'}}
__attribute__((target("sse3")))
static int definitely_used_fmv() { return 1; }
__attribute__((target("avx2")))
static int definitely_used_fmv() { return 2; }
__attribute__((target("default")))
static int definitely_used_fmv() { return 0; }
int definite_user() { return definitely_used_fmv(); }