-
Notifications
You must be signed in to change notification settings - Fork 1
clang_nowarn_bfd_mark_unused
Tsukasa OI edited this page Sep 15, 2022
·
8 revisions
- Status: Merged for Binutils 2.40
- Branch:
clang-nowarn-bfd-mark-unused
- Tracking PR: #53 (view Pull Request and Diff)
- Mailing List:
- PATCH v1 (2022-09-15)
- PATCH v2 (with incorrect subject line) (2022-09-15)
- PATCH v3 (2022-09-15)
Clang generates a warning on "written but not read thereafter" varibles (-Wset-but-unused-variable
), making the build failure.
We could just remove practically unused variables but instead I chose to keep some of them but with ATTRIBUTE_UNUSED
.
This is because such variables may have possible uses in the future.
Others are just removed.
ATTRIBUTE_UNUSED
(__attribute__((unused))
) marks a variable possibly unused and suppresses warnings about "written but not read thereafter" or just "unused" variables.
Note that it only means a variable is "possibly unused". Even if a variable with this attribute is "used", it's completely safe (removing the attribute when a variable is started to be used is definitely better, though).