[libcamera-devel,v2] kms: flag 'request' as 'maybe_unused' to avoid 'unused-parameter' warnings
diff mbox series

Message ID 20221118203951.89812-1-Rauch.Christian@gmx.de
State Accepted
Headers show
Series
  • [libcamera-devel,v2] kms: flag 'request' as 'maybe_unused' to avoid 'unused-parameter' warnings
Related show

Commit Message

Christian Rauch Nov. 18, 2022, 8:39 p.m. UTC
The parameter 'request' is only used in an assert. assert is only defined
for debug builds and release builds will not use the parameter, resulting
in warnings messages only for non-debug builds.
Fix this by flagging the parameter as 'maybe_unused'.

Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
---
 src/apps/cam/kms_sink.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.34.1

Comments

Laurent Pinchart Nov. 19, 2022, 12:27 a.m. UTC | #1
Hi Christian,

Thank you for the patch.

On Fri, Nov 18, 2022 at 09:39:51PM +0100, Christian Rauch via libcamera-devel wrote:
> The parameter 'request' is only used in an assert. assert is only defined
> for debug builds and release builds will not use the parameter, resulting
> in warnings messages only for non-debug builds.
> Fix this by flagging the parameter as 'maybe_unused'.
> 
> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>

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

> ---
>  src/apps/cam/kms_sink.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/apps/cam/kms_sink.cpp b/src/apps/cam/kms_sink.cpp
> index 754b061e..353209cd 100644
> --- a/src/apps/cam/kms_sink.cpp
> +++ b/src/apps/cam/kms_sink.cpp
> @@ -517,7 +517,7 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)
>  	return false;
>  }
> 
> -void KMSSink::requestComplete(DRM::AtomicRequest *request)
> +void KMSSink::requestComplete([[maybe_unused]] DRM::AtomicRequest *request)
>  {
>  	std::lock_guard<std::mutex> lock(lock_);
>
Laurent Pinchart Nov. 19, 2022, 12:29 a.m. UTC | #2
On Sat, Nov 19, 2022 at 02:27:30AM +0200, Laurent Pinchart wrote:
> Hi Christian,
> 
> Thank you for the patch.
> 
> On Fri, Nov 18, 2022 at 09:39:51PM +0100, Christian Rauch via libcamera-devel wrote:
> > The parameter 'request' is only used in an assert. assert is only defined
> > for debug builds and release builds will not use the parameter, resulting
> > in warnings messages only for non-debug builds.
> > Fix this by flagging the parameter as 'maybe_unused'.
> > 
> > Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I forgot to mention, the subject line should start with "apps: cam:". It
then gets a bit long, so I propose

apps: cam: kms: Avoid 'unused-parameter' warnings

If you're fine with that I'll change it when applying.

> > ---
> >  src/apps/cam/kms_sink.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/apps/cam/kms_sink.cpp b/src/apps/cam/kms_sink.cpp
> > index 754b061e..353209cd 100644
> > --- a/src/apps/cam/kms_sink.cpp
> > +++ b/src/apps/cam/kms_sink.cpp
> > @@ -517,7 +517,7 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)
> >  	return false;
> >  }
> > 
> > -void KMSSink::requestComplete(DRM::AtomicRequest *request)
> > +void KMSSink::requestComplete([[maybe_unused]] DRM::AtomicRequest *request)
> >  {
> >  	std::lock_guard<std::mutex> lock(lock_);
> >
Umang Jain Nov. 19, 2022, 5:22 a.m. UTC | #3
Hello,

On 11/19/22 5:59 AM, Laurent Pinchart via libcamera-devel wrote:
> On Sat, Nov 19, 2022 at 02:27:30AM +0200, Laurent Pinchart wrote:
>> Hi Christian,
>>
>> Thank you for the patch.
>>
>> On Fri, Nov 18, 2022 at 09:39:51PM +0100, Christian Rauch via libcamera-devel wrote:
>>> The parameter 'request' is only used in an assert. assert is only defined
>>> for debug builds and release builds will not use the parameter, resulting
>>> in warnings messages only for non-debug builds.
>>> Fix this by flagging the parameter as 'maybe_unused'.
>>>
>>> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> I forgot to mention, the subject line should start with "apps: cam:". It
> then gets a bit long, so I propose
>
> apps: cam: kms: Avoid 'unused-parameter' warnings
>
> If you're fine with that I'll change it when applying.

LGTM,

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>
>>> ---
>>>   src/apps/cam/kms_sink.cpp | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/apps/cam/kms_sink.cpp b/src/apps/cam/kms_sink.cpp
>>> index 754b061e..353209cd 100644
>>> --- a/src/apps/cam/kms_sink.cpp
>>> +++ b/src/apps/cam/kms_sink.cpp
>>> @@ -517,7 +517,7 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)
>>>   	return false;
>>>   }
>>>
>>> -void KMSSink::requestComplete(DRM::AtomicRequest *request)
>>> +void KMSSink::requestComplete([[maybe_unused]] DRM::AtomicRequest *request)
>>>   {
>>>   	std::lock_guard<std::mutex> lock(lock_);
>>>
Christian Rauch Nov. 20, 2022, 1:39 p.m. UTC | #4
Hi Laurent,

Am 19.11.22 um 01:29 schrieb Laurent Pinchart:
> On Sat, Nov 19, 2022 at 02:27:30AM +0200, Laurent Pinchart wrote:
>> Hi Christian,
>>
>> Thank you for the patch.
>>
>> On Fri, Nov 18, 2022 at 09:39:51PM +0100, Christian Rauch via libcamera-devel wrote:
>>> The parameter 'request' is only used in an assert. assert is only defined
>>> for debug builds and release builds will not use the parameter, resulting
>>> in warnings messages only for non-debug builds.
>>> Fix this by flagging the parameter as 'maybe_unused'.
>>>
>>> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
>>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I forgot to mention, the subject line should start with "apps: cam:". It
> then gets a bit long, so I propose
>
> apps: cam: kms: Avoid 'unused-parameter' warnings
>
> If you're fine with that I'll change it when applying.

Yes, I am fine with you changing the commit message.

Thanks,
Christian

>
>>> ---
>>>   src/apps/cam/kms_sink.cpp | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/apps/cam/kms_sink.cpp b/src/apps/cam/kms_sink.cpp
>>> index 754b061e..353209cd 100644
>>> --- a/src/apps/cam/kms_sink.cpp
>>> +++ b/src/apps/cam/kms_sink.cpp
>>> @@ -517,7 +517,7 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)
>>>   	return false;
>>>   }
>>>
>>> -void KMSSink::requestComplete(DRM::AtomicRequest *request)
>>> +void KMSSink::requestComplete([[maybe_unused]] DRM::AtomicRequest *request)
>>>   {
>>>   	std::lock_guard<std::mutex> lock(lock_);
>>>
>

Patch
diff mbox series

diff --git a/src/apps/cam/kms_sink.cpp b/src/apps/cam/kms_sink.cpp
index 754b061e..353209cd 100644
--- a/src/apps/cam/kms_sink.cpp
+++ b/src/apps/cam/kms_sink.cpp
@@ -517,7 +517,7 @@  bool KMSSink::processRequest(libcamera::Request *camRequest)
 	return false;
 }

-void KMSSink::requestComplete(DRM::AtomicRequest *request)
+void KMSSink::requestComplete([[maybe_unused]] DRM::AtomicRequest *request)
 {
 	std::lock_guard<std::mutex> lock(lock_);