From: Daniel Vetter <daniel@ffwll.ch>
To: "Morton, Derek J" <derek.j.morton@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Wood, Thomas" <thomas.wood@intel.com>
Subject: Re: [PATCH i-g-t] libs/igt_core.c: Fix compile warnings in igt_core.c
Date: Wed, 20 May 2015 11:19:14 +0200 [thread overview]
Message-ID: <20150520091914.GE15256@phenom.ffwll.local> (raw)
In-Reply-To: <2D016F5BA44C744783BA96B1D3EBC5BDA4E59E@IRSMSX102.ger.corp.intel.com>
On Wed, May 20, 2015 at 08:37:56AM +0000, Morton, Derek J wrote:
> >> > -----Original Message-----
> >> > From: Morton, Derek J
> >> > Sent: Tuesday, May 19, 2015 12:21 PM
> >> > To: intel-gfx@lists.freedesktop.org
> >> > Cc: Wood, Thomas; Gore, Tim; Morton, Derek J
> >> > Subject: [PATCH i-g-t] libs/igt_core.c: Fix compile warnings in
> >> > igt_core.c
> >> >
> >> > Fixed variables incorrectly declared as signed instead of unsigned.
> >
> >Which kind of compiler warning is this? Imo
> >
> > for (unsigned int i = 0; i < something; i++)
> >
> >is just not C style, the int there is perfectly fine. We've had this problem before with Android going ridiculously overboard with >compiler warnings, and the solution back then was to remove all the silly ones for igt. It smells like the same is appropriate for this >one here too.
> >
>
> The warning occurs because 'something' is of an unsigned type. In this
> case the macro ARRAY_SIZE uses sizeof() which returns an unsigned type.
> Implicit conversion between signed and unsigned types has always
> resulted in compiler warnings in my experience. It is not something
> android specific.
I don't have them here when building igt, and ARRAY_SIZE is also
extensively used in the kernel, also with size_of. This really sounds like
Android again going overboard with enabling compiler warnings to me.
Also the warning is silly here, since ARRAY_SIZE is statically known and
gcc can figure out that there's no overflow possible. The warning level in
kernel is such that you get overflow warnings only when gcc can prove that
there's an overflow. Which makes sense, but this here imo really doesn't.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-05-20 9:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 11:21 [PATCH i-g-t] libs/igt_core.c: Fix compile warnings in igt_core.c Derek Morton
2015-05-19 13:35 ` Gore, Tim
2015-05-20 7:12 ` Daniel Vetter
2015-05-20 8:37 ` Morton, Derek J
2015-05-20 9:19 ` Daniel Vetter [this message]
2015-05-20 9:48 ` Damien Lespiau
2015-05-20 10:12 ` Gore, Tim
2015-05-20 11:14 ` Jani Nikula
-- strict thread matches above, loose matches on Subject: below --
2015-05-19 14:26 Derek Morton
2015-05-20 7:29 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150520091914.GE15256@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=derek.j.morton@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=thomas.wood@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox