Skip to content

Conversation

@OldManYellsAtCloud
Copy link
Contributor

When using gcc (with ~-Werror=unused-result), compilation fails, because the return value of lockf is ignored at one place.

To avoid this error, assign the return value to std::ignore.

The error message:

| ../sources/libpisp-1.2.1/src/helpers/media_device.cpp: In member function 'std::map<std::__cxx11::basic_string<char>, libpisp::helpers::DeviceFd>::iterator libpisp::helpers::MediaDevice::unlock(const std::string&)':
| ../sources/libpisp-1.2.1/src/helpers/media_device.cpp:251:14: error: ignoring return value of 'int lockf(int, int, __off64_t)' declared with attribute 'warn_unused_result' [-Werror=unused-result]
|   251 |         lockf(it->second.Get(), F_ULOCK, 0);
|       |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1plus: all warnings being treated as errors

When using gcc (with ~-Werror=unused-result), compilation fails,
because the return value of lockf is ignored at one place.

To avoid this error, assign the return value to std::ignore.

Signed-off-by: Gyorgy Sarvari <[email protected]>
@naushir naushir merged commit f2bbf7e into raspberrypi:main Sep 18, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants