This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Fix build with -Wunused-function
ClosedPublic

Authored by smeenai on Jul 27 2023, 4:57 PM.

Details

Reviewers
philnik
Group Reviewers
Restricted Project
Commits
rG3da76c211617: [libunwind] Fix build with -Wunused-function
Summary

https://reviews.llvm.org/D144252 removed -Wno-unused-function from the
libunwind build, but we have an unused function when you're building for
armv7 without assertions. Mark that function as possibly unused to avoid
the warning, and mark the parameter as a const pointer while I'm here to
make it clear that nothing is modified by a debugging function.

Diff Detail

Event Timeline

smeenai created this revision.Jul 27 2023, 4:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 4:57 PM
smeenai requested review of this revision.Jul 27 2023, 4:57 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 27 2023, 4:57 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
smeenai edited the summary of this revision. (Show Details)Jul 27 2023, 4:58 PM

I would just mark it [[maybe_unused]]. It's not like this is costly to compile.

I would just mark it [[maybe_unused]]. It's not like this is costly to compile.

libunwind builds with C++11 (https://github.com/llvm/llvm-project/blob/2f976b921071cf4349175554f690798a0d2b81f3/libunwind/src/CMakeLists.txt#L140). Dunno if that's intentional or just an oversight. Both gcc and Clang seem to support [[maybe_unused]] in C++11 as an extension anyway, but I could use [[gnu::unused]] if we want to avoid -pedantic warnings.

smeenai updated this revision to Diff 544983.Jul 27 2023, 5:23 PM
smeenai edited the summary of this revision. (Show Details)

Use [[gnu::unused]] instead

philnik accepted this revision.Jul 27 2023, 7:49 PM

I don't think there is any reason that we use C++11 for libunwind, but that is a different project. LGTM.

This revision is now accepted and ready to land.Jul 27 2023, 7:49 PM
This revision was landed with ongoing or failed builds.Jul 27 2023, 8:23 PM
This revision was automatically updated to reflect the committed changes.