[libcamera-devel] libcamera: Use C++17 [[fallthrough]] everywhere
diff mbox series

Message ID 20230104161501.100221-1-matti.lehtimaki@gmail.com
State Accepted
Commit 504b6437613f35de043485bd064843d6af269c74
Headers show
Series
  • [libcamera-devel] libcamera: Use C++17 [[fallthrough]] everywhere
Related show

Commit Message

Matti Lehtimäki Jan. 4, 2023, 4:15 p.m. UTC
Fixes build failure on some build environments.

Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
---
 src/gstreamer/gstlibcamera-utils.cpp | 2 +-
 src/libcamera/camera_sensor.cpp      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Jan. 5, 2023, 7:11 a.m. UTC | #1
Hi Matti,

On Wed, Jan 04, 2023 at 06:15:01PM +0200, Matti Lehtimäki via libcamera-devel wrote:
> Fixes build failure on some build environments.

Would you be able to tell us what those build environments are ? We try
have a wide coverage of build targets and environments in our tests, and
the fact that we didn't catch this issue shows that an additional
environment should be added.

> Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 2 +-
>  src/libcamera/camera_sensor.cpp      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 16aac441..750ec351 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -154,7 +154,7 @@ colorspace_from_colorimetry(const GstVideoColorimetry &colorimetry)
>  	case GST_VIDEO_TRANSFER_GAMMA22:
>  	case GST_VIDEO_TRANSFER_GAMMA28:
>  		GST_WARNING("GAMMA 18, 20, 22, 28 transfer functions not supported");
> -	/* fallthrough */
> +		[[fallthrough]];
>  	case GST_VIDEO_TRANSFER_GAMMA10:
>  		colorspace->transferFunction = ColorSpace::TransferFunction::Linear;
>  		break;
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index ae3127d6..a210aa4f 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -427,7 +427,7 @@ int CameraSensor::initProperties()
>  			LOG(CameraSensor, Warning)
>  				<< "Unsupported camera location "
>  				<< v4l2Orientation << ", setting to External";
> -			/* Fall-through */
> +			[[fallthrough]];
>  		case V4L2_CAMERA_ORIENTATION_EXTERNAL:
>  			propertyValue = properties::CameraLocationExternal;
>  			break;
Jacopo Mondi Jan. 5, 2023, 9:08 a.m. UTC | #2
Hi Matti

On Thu, Jan 05, 2023 at 09:11:19AM +0200, Laurent Pinchart via libcamera-devel wrote:
> Hi Matti,
>
> On Wed, Jan 04, 2023 at 06:15:01PM +0200, Matti Lehtimäki via libcamera-devel wrote:
> > Fixes build failure on some build environments.
>
> Would you be able to tell us what those build environments are ? We try
> have a wide coverage of build targets and environments in our tests, and
> the fact that we didn't catch this issue shows that an additional
> environment should be added.
>
> > Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
   j

> > ---
> >  src/gstreamer/gstlibcamera-utils.cpp | 2 +-
> >  src/libcamera/camera_sensor.cpp      | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> > index 16aac441..750ec351 100644
> > --- a/src/gstreamer/gstlibcamera-utils.cpp
> > +++ b/src/gstreamer/gstlibcamera-utils.cpp
> > @@ -154,7 +154,7 @@ colorspace_from_colorimetry(const GstVideoColorimetry &colorimetry)
> >  	case GST_VIDEO_TRANSFER_GAMMA22:
> >  	case GST_VIDEO_TRANSFER_GAMMA28:
> >  		GST_WARNING("GAMMA 18, 20, 22, 28 transfer functions not supported");
> > -	/* fallthrough */
> > +		[[fallthrough]];
> >  	case GST_VIDEO_TRANSFER_GAMMA10:
> >  		colorspace->transferFunction = ColorSpace::TransferFunction::Linear;
> >  		break;
> > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> > index ae3127d6..a210aa4f 100644
> > --- a/src/libcamera/camera_sensor.cpp
> > +++ b/src/libcamera/camera_sensor.cpp
> > @@ -427,7 +427,7 @@ int CameraSensor::initProperties()
> >  			LOG(CameraSensor, Warning)
> >  				<< "Unsupported camera location "
> >  				<< v4l2Orientation << ", setting to External";
> > -			/* Fall-through */
> > +			[[fallthrough]];
> >  		case V4L2_CAMERA_ORIENTATION_EXTERNAL:
> >  			propertyValue = properties::CameraLocationExternal;
> >  			break;
>
> --
> Regards,
>
> Laurent Pinchart
Matti Lehtimäki Jan. 5, 2023, 9:11 a.m. UTC | #3
Hi

The build failure happened when building libcamera in Sailfish OS 
Platform SDK which has gcc 8.3.

-Matti

On 5.1.2023 9.11, Laurent Pinchart wrote:
> Hi Matti,
> 
> On Wed, Jan 04, 2023 at 06:15:01PM +0200, Matti Lehtimäki via libcamera-devel wrote:
>> Fixes build failure on some build environments.
> 
> Would you be able to tell us what those build environments are ? We try
> have a wide coverage of build targets and environments in our tests, and
> the fact that we didn't catch this issue shows that an additional
> environment should be added.
> 
>> Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>   src/gstreamer/gstlibcamera-utils.cpp | 2 +-
>>   src/libcamera/camera_sensor.cpp      | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
>> index 16aac441..750ec351 100644
>> --- a/src/gstreamer/gstlibcamera-utils.cpp
>> +++ b/src/gstreamer/gstlibcamera-utils.cpp
>> @@ -154,7 +154,7 @@ colorspace_from_colorimetry(const GstVideoColorimetry &colorimetry)
>>   	case GST_VIDEO_TRANSFER_GAMMA22:
>>   	case GST_VIDEO_TRANSFER_GAMMA28:
>>   		GST_WARNING("GAMMA 18, 20, 22, 28 transfer functions not supported");
>> -	/* fallthrough */
>> +		[[fallthrough]];
>>   	case GST_VIDEO_TRANSFER_GAMMA10:
>>   		colorspace->transferFunction = ColorSpace::TransferFunction::Linear;
>>   		break;
>> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
>> index ae3127d6..a210aa4f 100644
>> --- a/src/libcamera/camera_sensor.cpp
>> +++ b/src/libcamera/camera_sensor.cpp
>> @@ -427,7 +427,7 @@ int CameraSensor::initProperties()
>>   			LOG(CameraSensor, Warning)
>>   				<< "Unsupported camera location "
>>   				<< v4l2Orientation << ", setting to External";
>> -			/* Fall-through */
>> +			[[fallthrough]];
>>   		case V4L2_CAMERA_ORIENTATION_EXTERNAL:
>>   			propertyValue = properties::CameraLocationExternal;
>>   			break;
>
Laurent Pinchart Jan. 5, 2023, 10:03 a.m. UTC | #4
Hi Matti,

On Thu, Jan 05, 2023 at 11:11:10AM +0200, Matti Lehtimäki wrote:
> Hi
> 
> The build failure happened when building libcamera in Sailfish OS 
> Platform SDK which has gcc 8.3.

Thank you. I build with gcc-8.3.0 already and don't see any error. There
must be some difference between our environments. I'm not sure I want to
spend too much time investigating though :-)

Nice to hear you have an interest in libcamera for Sailfish OS. Please
let me know if we can be of any help to improve support for your
platforms.

> On 5.1.2023 9.11, Laurent Pinchart wrote:
> > On Wed, Jan 04, 2023 at 06:15:01PM +0200, Matti Lehtimäki via libcamera-devel wrote:
> >> Fixes build failure on some build environments.
> > 
> > Would you be able to tell us what those build environments are ? We try
> > have a wide coverage of build targets and environments in our tests, and
> > the fact that we didn't catch this issue shows that an additional
> > environment should be added.
> > 
> >> Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
> > 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> >> ---
> >>   src/gstreamer/gstlibcamera-utils.cpp | 2 +-
> >>   src/libcamera/camera_sensor.cpp      | 2 +-
> >>   2 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> >> index 16aac441..750ec351 100644
> >> --- a/src/gstreamer/gstlibcamera-utils.cpp
> >> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> >> @@ -154,7 +154,7 @@ colorspace_from_colorimetry(const GstVideoColorimetry &colorimetry)
> >>   	case GST_VIDEO_TRANSFER_GAMMA22:
> >>   	case GST_VIDEO_TRANSFER_GAMMA28:
> >>   		GST_WARNING("GAMMA 18, 20, 22, 28 transfer functions not supported");
> >> -	/* fallthrough */
> >> +		[[fallthrough]];
> >>   	case GST_VIDEO_TRANSFER_GAMMA10:
> >>   		colorspace->transferFunction = ColorSpace::TransferFunction::Linear;
> >>   		break;
> >> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> >> index ae3127d6..a210aa4f 100644
> >> --- a/src/libcamera/camera_sensor.cpp
> >> +++ b/src/libcamera/camera_sensor.cpp
> >> @@ -427,7 +427,7 @@ int CameraSensor::initProperties()
> >>   			LOG(CameraSensor, Warning)
> >>   				<< "Unsupported camera location "
> >>   				<< v4l2Orientation << ", setting to External";
> >> -			/* Fall-through */
> >> +			[[fallthrough]];
> >>   		case V4L2_CAMERA_ORIENTATION_EXTERNAL:
> >>   			propertyValue = properties::CameraLocationExternal;
> >>   			break;

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 16aac441..750ec351 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -154,7 +154,7 @@  colorspace_from_colorimetry(const GstVideoColorimetry &colorimetry)
 	case GST_VIDEO_TRANSFER_GAMMA22:
 	case GST_VIDEO_TRANSFER_GAMMA28:
 		GST_WARNING("GAMMA 18, 20, 22, 28 transfer functions not supported");
-	/* fallthrough */
+		[[fallthrough]];
 	case GST_VIDEO_TRANSFER_GAMMA10:
 		colorspace->transferFunction = ColorSpace::TransferFunction::Linear;
 		break;
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index ae3127d6..a210aa4f 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -427,7 +427,7 @@  int CameraSensor::initProperties()
 			LOG(CameraSensor, Warning)
 				<< "Unsupported camera location "
 				<< v4l2Orientation << ", setting to External";
-			/* Fall-through */
+			[[fallthrough]];
 		case V4L2_CAMERA_ORIENTATION_EXTERNAL:
 			propertyValue = properties::CameraLocationExternal;
 			break;