* [PATCH] i915: fix build error with -Werror
@ 2016-07-04 14:29 Jeff Mahoney
2016-07-04 15:29 ` Jeff Mahoney
2016-07-04 15:30 ` [PATCH v2] " Jeff Mahoney
0 siblings, 2 replies; 5+ messages in thread
From: Jeff Mahoney @ 2016-07-04 14:29 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula; +Cc: intel-gfx
This fixes the following build error with -Werror and gcc 6.1:
drivers/gpu/drm/i915/i915_debugfs.c:2103:6: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2101,8 +2101,9 @@ static int i915_dump_lrc(struct seq_file
list_for_each_entry(ctx, &dev_priv->context_list, link)
if (ctx != dev_priv->kernel_context)
- for_each_engine(engine, dev_priv)
+ for_each_engine(engine, dev_priv) {
i915_dump_lrc_obj(m, ctx, engine);
+ }
mutex_unlock(&dev->struct_mutex);
--
Jeff Mahoney
SUSE Labs
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i915: fix build error with -Werror
2016-07-04 14:29 [PATCH] i915: fix build error with -Werror Jeff Mahoney
@ 2016-07-04 15:29 ` Jeff Mahoney
2016-07-04 15:30 ` [PATCH v2] " Jeff Mahoney
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Mahoney @ 2016-07-04 15:29 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula; +Cc: intel-gfx
[-- Attachment #1.1.1: Type: text/plain, Size: 1010 bytes --]
On 7/4/16 10:29 AM, Jeff Mahoney wrote:
> This fixes the following build error with -Werror and gcc 6.1:
>
> drivers/gpu/drm/i915/i915_debugfs.c:2103:6: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
Oops. It turns out my build test wasn't using gcc6. This doesn't fix
the error. I'll post v2 shortly.
-Jeff
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2101,8 +2101,9 @@ static int i915_dump_lrc(struct seq_file
>
> list_for_each_entry(ctx, &dev_priv->context_list, link)
> if (ctx != dev_priv->kernel_context)
> - for_each_engine(engine, dev_priv)
> + for_each_engine(engine, dev_priv) {
> i915_dump_lrc_obj(m, ctx, engine);
> + }
>
> mutex_unlock(&dev->struct_mutex);
>
>
--
Jeff Mahoney
SUSE Labs
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 881 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] i915: fix build error with -Werror
2016-07-04 14:29 [PATCH] i915: fix build error with -Werror Jeff Mahoney
2016-07-04 15:29 ` Jeff Mahoney
@ 2016-07-04 15:30 ` Jeff Mahoney
2016-07-19 7:05 ` Daniel Vetter
1 sibling, 1 reply; 5+ messages in thread
From: Jeff Mahoney @ 2016-07-04 15:30 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula; +Cc: intel-gfx
This fixes the following build error with -Werror and gcc 6.1:
drivers/gpu/drm/i915/i915_debugfs.c:2103:6: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2100,9 +2100,10 @@ static int i915_dump_lrc(struct seq_file
return ret;
list_for_each_entry(ctx, &dev_priv->context_list, link)
- if (ctx != dev_priv->kernel_context)
+ if (ctx != dev_priv->kernel_context) {
for_each_engine(engine, dev_priv)
i915_dump_lrc_obj(m, ctx, engine);
+ }
mutex_unlock(&dev->struct_mutex);
--
Jeff Mahoney
SUSE Labs
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] i915: fix build error with -Werror
2016-07-04 15:30 ` [PATCH v2] " Jeff Mahoney
@ 2016-07-19 7:05 ` Daniel Vetter
2016-07-19 14:18 ` Dave Gordon
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2016-07-19 7:05 UTC (permalink / raw)
To: Jeff Mahoney; +Cc: Daniel Vetter, intel-gfx
On Mon, Jul 04, 2016 at 11:30:06AM -0400, Jeff Mahoney wrote:
> This fixes the following build error with -Werror and gcc 6.1:
>
> drivers/gpu/drm/i915/i915_debugfs.c:2103:6: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
>
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This doesn't apply on -next any more ... Is this still an issue on latest
kernels?
-Daniel
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2100,9 +2100,10 @@ static int i915_dump_lrc(struct seq_file
> return ret;
>
> list_for_each_entry(ctx, &dev_priv->context_list, link)
> - if (ctx != dev_priv->kernel_context)
> + if (ctx != dev_priv->kernel_context) {
> for_each_engine(engine, dev_priv)
> i915_dump_lrc_obj(m, ctx, engine);
> + }
>
> mutex_unlock(&dev->struct_mutex);
>
>
>
> --
> Jeff Mahoney
> SUSE Labs
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] i915: fix build error with -Werror
2016-07-19 7:05 ` Daniel Vetter
@ 2016-07-19 14:18 ` Dave Gordon
0 siblings, 0 replies; 5+ messages in thread
From: Dave Gordon @ 2016-07-19 14:18 UTC (permalink / raw)
To: Daniel Vetter, Jeff Mahoney; +Cc: Daniel Vetter, intel-gfx
On 19/07/16 08:05, Daniel Vetter wrote:
> On Mon, Jul 04, 2016 at 11:30:06AM -0400, Jeff Mahoney wrote:
>> This fixes the following build error with -Werror and gcc 6.1:
>>
>> drivers/gpu/drm/i915/i915_debugfs.c:2103:6: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
>>
>> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
>
> This doesn't apply on -next any more ... Is this still an issue on latest
> kernels?
> -Daniel
>> ---
>> drivers/gpu/drm/i915/i915_debugfs.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> --- a/drivers/gpu/drm/i915/i915_debugfs.c
>> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
>> @@ -2100,9 +2100,10 @@ static int i915_dump_lrc(struct seq_file
>> return ret;
>>
>> list_for_each_entry(ctx, &dev_priv->context_list, link)
>> - if (ctx != dev_priv->kernel_context)
>> + if (ctx != dev_priv->kernel_context) {
>> for_each_engine(engine, dev_priv)
>> i915_dump_lrc_obj(m, ctx, engine);
>> + }
>>
>> mutex_unlock(&dev->struct_mutex);
That's a curious warning. Ever since
commit 373701b1fc7d7c0013ae4fffd8103615c150751e
drm: fix potential dangling else problems in for_each_ macros
Author: Jani Nikula <jani.nikula@intel.com>
Date: Tue Nov 24 21:21:55 2015 +0200
Link:
http://patchwork.freedesktop.org/patch/msgid/1448392916-2281-1-git-send-email-jani.nikula@intel.com
we've avoided leaving a dangling else; the code should expand as
for ( /* each entry */ )
if (ctx != dev_priv->kernel_context)
for ( /* each engine */ )
if (!intel_engine_initialized(engine))
{}
else
i915_dump_lrc_obj(m, ctx, engine);
... so that the (hidden) else is clearly matched with the (hidden) if()
generated by the macro expansion. Surely the compiler can't think that
an else inside a for-loop could be mistakenly paired with one outside
the loop?
Of course we did *have* a proposal for an alternative iterator strategy
that didn't expose any if/else at all, but some people didn't like it :L
Oh well, it just shows that using macros to rewrite C syntax is still an
abomination, Stephen Bourne notwithstanding. If you want iterators and
blocks, use Ruby ;)
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-07-19 14:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04 14:29 [PATCH] i915: fix build error with -Werror Jeff Mahoney
2016-07-04 15:29 ` Jeff Mahoney
2016-07-04 15:30 ` [PATCH v2] " Jeff Mahoney
2016-07-19 7:05 ` Daniel Vetter
2016-07-19 14:18 ` Dave Gordon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.