-
Notifications
You must be signed in to change notification settings - Fork 3k
ShellPkg/AcpiView: Fix unused variable warnings in RimtParser #11808
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
Conversation
|
Hi Ard, |
ef5d9be to
64ba5c5
Compare
Instead, I've replaced the |
Clang complains about unused variables:
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:21:60: error: variable 'mRimtNodeHeader' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
21 | STATIC EFI_ACPI_6_6_RIMT_NODE_HEADER_STRUCTURE mRimtNodeHeader;
| ^~~~~~~~~~~~~~~
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:25:60: error: variable 'mRimtIdMappingNode' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
25 | STATIC EFI_ACPI_6_6_RIMT_ID_MAPPING_STRUCTURE mRimtIdMappingNode;
| ^~~~~~~~~~~~~~~~~~
28 | STATIC EFI_ACPI_6_6_RIMT_PCIE_ROOT_COMPLEX_NODE_STRUCTURE mRimtPcieRootComplexNode;
| ^~~~~~~~~~~~~~~~~~~~~~~~
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:29:60: error: variable 'mRimtIommuNode' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
29 | STATIC EFI_ACPI_6_6_RIMT_IOMMU_NODE_STRUCTURE mRimtIommuNode;
| ^~~~~~~~~~~~~~
4 errors generated.
This is because these variables are only used to take the size of their
fields using the sizeof() operator, which does not support type names
directly.
So create a helper macro SIZE_OF_T () that provides the functionality we
need, and drop the unused variables.
Signed-off-by: Ard Biesheuvel <[email protected]>
64ba5c5 to
9ab4d5b
Compare
Clang complains about unused variables:
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:21:60: error: variable 'mRimtNodeHeader' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
21 | STATIC EFI_ACPI_6_6_RIMT_NODE_HEADER_STRUCTURE mRimtNodeHeader;
| ^~~~~~~~~~~~~~~
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:25:60: error: variable 'mRimtIdMappingNode' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
25 | STATIC EFI_ACPI_6_6_RIMT_ID_MAPPING_STRUCTURE mRimtIdMappingNode;
| ^~~~~~~~~~~~~~~~~~
28 | STATIC EFI_ACPI_6_6_RIMT_PCIE_ROOT_COMPLEX_NODE_STRUCTURE mRimtPcieRootComplexNode;
| ^~~~~~~~~~~~~~~~~~~~~~~~
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:29:60: error: variable 'mRimtIommuNode' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
29 | STATIC EFI_ACPI_6_6_RIMT_IOMMU_NODE_STRUCTURE mRimtIommuNode;
| ^~~~~~~~~~~~~~
4 errors generated.
This is because these variables are only used to take the size of their fields using the sizeof() operator.
So declare them as 'extern' instead, as no definition is actually needed for this use case.