[PATCH libdrm] xf86drm: fix compile error for declare i in for loop
Eric Engestrom
eric.engestrom at imgtec.com
Wed May 17 18:16:16 UTC 2017
On Wednesday, 2017-05-17 13:58:42 +0000, Yu, Qiang wrote:
> Hi Emil,
>
> I didn't modify the code. I'm using Ubuntu 14.04 gcc 4.8.4, the configure pass but
> fail when compile.
>
> I think my gcc support c99 but needs adding "-std=c99" to enable it, and the configure
> script add it into CC variable.
>From the AC_PROG_CC_C99 docs:
> If the C compiler is not in C99 mode by default, try to add an option
> to output variable `CC` to make it so.
Grrrr... Add that to the pile of reasons to move away from autotools,
I suppose.
> When just use "make", it's OK, but my build script uses
> "make CC=gcc".
>
> If you think current state is OK, I can change my build script for that.
Yes, I think you should change your build command. It's a shame that
autotools has this bug, but we'd like to avoid changing our codebase to
work around these, and in this case, it would mean dropping the C99
requirement and having to downgrade the whole codebase to something
older.
>
> Regards,
> Qiang
> ________________________________________
> From: Emil Velikov <emil.l.velikov at gmail.com>
> Sent: Wednesday, May 17, 2017 9:17:53 PM
> To: Yu, Qiang
> Cc: ML dri-devel
> Subject: Re: [PATCH libdrm] xf86drm: fix compile error for declare i in for loop
>
> Hi Qiang Yu,
>
> On 17 May 2017 at 10:26, Qiang Yu <Qiang.Yu at amd.com> wrote:
> > error log:
> > xf86drm.c: In function 'parse_separate_sysfs_files':
> > xf86drm.c:3104:5: error: 'for' loop initial declarations are only allowed in C99 mode
> > for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) {
> > ^
> > xf86drm.c:3104:5: note: use option -std=c99 or -std=gnu99 to compile your code
> > make[4]: *** [libdrm_la-xf86drm.lo] Error 1
> >
> configure should error out if the compiler does not support C99. Are
> you explicitly patching that out?
> Why can't we use a C99 in 2017 - gcc and clang has supported it for 10+ years.
>
> Thanks
> Emil
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list