Skip to content

[FMV] -Wunused-function incorrectly complains about versioned static functions #80227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jroelofs opened this issue Feb 1, 2024 · 2 comments · Fixed by #81167
Closed

[FMV] -Wunused-function incorrectly complains about versioned static functions #80227

jroelofs opened this issue Feb 1, 2024 · 2 comments · Fixed by #81167
Assignees
Labels
backend:AArch64 clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@jroelofs
Copy link
Contributor

jroelofs commented Feb 1, 2024

https://clang.godbolt.org/z/9G6YT4eYc

extern "C" void fast(void);
extern "C" void slow(void);

__attribute__((target_version("i8mm")))
static void callee(void) { fast(); }

__attribute__((target_version("default")))
static void callee(void) { slow(); }

int main() {
    callee();
}

--rtlib=compiler-rt -Werror=unused-function -Wall

<source>:5:13: error: unused function 'callee' [-Werror,-Wunused-function]
    5 | static void callee(void) { fast(); }
      |             ^~~~~~
1 error generated.
Compiler returned: 1
@jroelofs jroelofs added backend:AArch64 clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer labels Feb 1, 2024
@jroelofs
Copy link
Contributor Author

jroelofs commented Feb 1, 2024

cc @ilinpv

@llvmbot
Copy link
Member

llvmbot commented Feb 1, 2024

@llvm/issue-subscribers-backend-aarch64

Author: Jon Roelofs (jroelofs)

https://clang.godbolt.org/z/9G6YT4eYc
extern "C" void fast(void);
extern "C" void slow(void);

__attribute__((target_version("i8mm")))
static void callee(void) { fast(); }

__attribute__((target_version("default")))
static void callee(void) { slow(); }

int main() {
    callee();
}

--rtlib=compiler-rt -Werror=unused-function -Wall

&lt;source&gt;:5:13: error: unused function 'callee' [-Werror,-Wunused-function]
    5 | static void callee(void) { fast(); }
      |             ^~~~~~
1 error generated.
Compiler returned: 1

@jroelofs jroelofs changed the title [FMV] -Wunused-function incorrectly complains about versioned functions [FMV] -Wunused-function incorrectly complains about versioned static functions Feb 8, 2024
jroelofs added a commit to jroelofs/llvm-project that referenced this issue Feb 8, 2024
…nctions

We should only warn if the default version is the one that is unused.

Fixes: llvm#80227
@jroelofs jroelofs self-assigned this Feb 8, 2024
jroelofs added a commit that referenced this issue Feb 9, 2024
…'s (#81167)

We should only warn if the default version is the one that is unused.

Fixes: #80227
MaskRay added a commit that referenced this issue Feb 9, 2024
…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")))`.
jroelofs added a commit to swiftlang/llvm-project that referenced this issue Feb 9, 2024
…'s (llvm#81167)

We should only warn if the default version is the one that is unused.

Fixes: llvm#80227
jroelofs pushed a commit to swiftlang/llvm-project that referenced this issue Feb 9, 2024
…lvm#81302)

The spurious -Wunused-function warning issue for `target_version` llvm#80227
also applied to `__attribute__((target(...)))` based FMV. llvm#81167 removed
warnings for all `target`-based FMV. This patch restores the warnings
for `__attribute__((target("default")))`.
jroelofs added a commit to swiftlang/llvm-project that referenced this issue Feb 11, 2024
…'s (llvm#81167)

We should only warn if the default version is the one that is unused.

Fixes: llvm#80227
jroelofs pushed a commit to swiftlang/llvm-project that referenced this issue Feb 11, 2024
…lvm#81302)

The spurious -Wunused-function warning issue for `target_version` llvm#80227
also applied to `__attribute__((target(...)))` based FMV. llvm#81167 removed
warnings for all `target`-based FMV. This patch restores the warnings
for `__attribute__((target("default")))`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants