commit | 82bf88f04d74c1d8b023b11dd2bd4a8b43ad4a73 | [log] [tgz] |
---|---|---|
author | Philipp Wagner <phw@lowrisc.org> | Tue Jun 15 09:51:23 2021 +0100 |
committer | Philipp Wagner <mail@philipp-wagner.com> | Fri Jun 18 20:24:47 2021 +0100 |
tree | 3f5daf33785fb40c67597d83a11dceb3f86bc2e2 | |
parent | e1d02b58bcbb8bf3d0c4f70ba62e4d03d760d309 [diff] |
[rv_plic/dif] Pass input data by value The argument `complete_data` of the `dif_plic_irq_complete()` function is used as value, not as out param as it is documented. Adjust the documentation to reflect that, and pass the argument by value. This was detected by compiling with GCC11, which a maybe-uninitialized warning in the PLIC unit test code, which causes the compilation to fail. ``` c++ -Isw/device/lib/dif/5fb29ed@@dif_plic_unittest@exe -I../sw/device/lib/dif -I/home/philipp/src/opentitan -I/home/philipp/src/opentitan/build-out -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++14 -g -DHOST_BUILD -Wimplicit-fallthrough -Wswitch-default -Wno-error=unused-function -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers -pthread -isystem../sw/vendor/google_googletest/googlemock -isystem../sw/vendor/google_googletest/googlemock/include -isystem../sw/vendor/google_googletest/googletest -isystem../sw/vendor/google_googletest/googletest/include -DMOCK_MMIO -MD -MQ 'sw/device/lib/dif/5fb29ed@@dif_plic_unittest@exe/dif_plic_unittest.cc.o' -MF 'sw/device/lib/dif/5fb29ed@@dif_plic_unittest@exe/dif_plic_unittest.cc.o.d' -o 'sw/device/lib/dif/5fb29ed@@dif_plic_unittest@exe/dif_plic_unittest.cc.o' -c ../sw/device/lib/dif/dif_plic_unittest.cc In file included from ../sw/vendor/google_googletest/googletest/include/gtest/gtest.h:376, from ../sw/device/lib/dif/dif_plic_unittest.cc:9: ../sw/device/lib/dif/dif_plic_unittest.cc: In member function ‘virtual void dif_plic_unittest::{anonymous}::IrqCompleteTest_NullArgs_Test::TestBody()’: ../sw/device/lib/dif/dif_plic_unittest.cc:345:34: error: ‘data’ may be used uninitialized [-Werror=maybe-uninitialized] 345 | EXPECT_EQ(dif_plic_irq_complete(nullptr, kTarget0, &data), kDifPlicBadArg); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../sw/device/lib/dif/dif_plic_unittest.cc:5: /home/philipp/src/opentitan/sw/device/lib/dif/dif_plic.h:295:19: note: by argument 3 of type ‘const dif_plic_irq_id_t*’ {aka ‘const unsigned int*’} to ‘dif_plic_result_t dif_plic_irq_complete(const dif_plic_t*, dif_plic_target_t, const dif_plic_irq_id_t*)’ declared here 295 | dif_plic_result_t dif_plic_irq_complete(const dif_plic_t *plic, | ^~~~~~~~~~~~~~~~~~~~~ ../sw/device/lib/dif/dif_plic_unittest.cc:344:21: note: ‘data’ declared here 344 | dif_plic_irq_id_t data; | ^~~~ cc1plus: all warnings being treated as errors ``` Signed-off-by: Philipp Wagner <phw@lowrisc.org>
OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.
This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.
The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.
Have a look at CONTRIBUTING and our documentation on project organization and processes for guidelines on how to contribute code to this repository.
Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).