[PATCH weston] gl: Don't declare variables in for loop

Daniel Stone daniel at fooishbar.org
Mon Nov 21 19:25:45 UTC 2016


Hi,

On 21 November 2016 at 19:05, Bryce Harrington <bryce at osg.samsung.com> wrote:
> On Mon, Nov 21, 2016 at 06:06:23PM +0000, Daniel Stone wrote:
>> On 21 November 2016 at 18:02, Bryce Harrington <bryce at osg.samsung.com> wrote:
>> >   libweston/gl-renderer.c:2862:2: error: ‘for’ loop initial declarations
>> >   are only allowed in C99 mode
>> >     for (unsigned i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint);
>> >     i++) {
>> >     ^
>>
>> Sorry, no idea how I didn't spot that during review. Out of interest,
>> what exotic compiler/CFLAGS are you using to have caught this?
>
> Nothing particularly fancy, I think most of this is just stock compiler
> settings for my distro:
>
> GCC_CFLAGS='-Wall -Wextra -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers \
>         -g -fvisibility=hidden -Wstrict-prototypes -Wmissing-prototypes -Wsign-compare'
>
> Here's the full warning for context:
> [...]
>
> So, looks more like -std=c99 just isn't set by default by the compiler
> on my system (which it shouldn't be, for wayland anyway.)  I'm running
> gcc 4.8.4 which is on the old side; perhaps things have changed wrt c99
> defaults used with newer compilers?

Oh, yeah. I'm on 6.2.1, and I'm quite sure the default standard
flipped to gnu99 since then.

> I haven't sorted out the -Wno-shift-negative-value warning but
> suspecting it's bogus.

Well, it's bogus to the extent that it doesn't appear with newer
toolchains, but still it'd be nice to get that sorted out. I'm pretty
sure one of the other projects (xserver? Mesa?) tries to filter out
options which aren't supported by your compiler version, which might
be nice to have.

>> Pushed
>> with review in any case:
>> To ssh://git.freedesktop.org/git/wayland/weston
>>    3447619..fe0410b  upstream -> master
>
> Thanks for reviewing and pushing,

No problem, sorry I missed it in the first.

Cheers,
Daniel


More information about the wayland-devel mailing list