diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-06-26 00:51:32 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-06-28 08:07:51 +0300 |
commit | d3fef998444c21142fa12b9bf698a73ee5706fd6 (patch) | |
tree | 238756e371eb7841c5e01f439d8897ca5c6ce331 /utils | |
parent | 9fcef36be69fe2c6842680ec78c432cbdbbdc92d (diff) |
libcamera: utils: Only enable utils::hex() for integer arguments
The utils::hex() function is defined as a function template that has
implementations for integer arguments only. When given a different
argument type, the compiler will not catch the issue, but linking will
fail:
src/libcamera/libcamera.so.p/camera_sensor.cpp.o: in function `libcamera::CameraSensor::validateSensorDriver()':
camera_sensor.cpp:(.text+0x1e6b): undefined reference to `libcamera::utils::_hex libcamera::utils::hex<libcamera::ControlId const*>(libcamera::ControlId const*, unsigned int)'
Move the failure to compilation time by enabling the function for
integer arguments only. This provides better diagnostics:
../../src/libcamera/camera_sensor.cpp: In member function ‘int libcamera::CameraSensor::validateSensorDriver()’:
../../src/libcamera/camera_sensor.cpp:199:77: error: no matching function for call to ‘hex(const libcamera::ControlId*&)’
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'utils')
0 files changed, 0 insertions, 0 deletions