diff mbox

package/expedite: fix build issue with C89

Message ID 20170421213104.1477-1-romain.naour@gmail.com
State Changes Requested
Headers show

Commit Message

Romain Naour April 21, 2017, 9:31 p.m. UTC
The code use for loop initial declarations which are only allowed in
C99 mode. Use the default compiler version (gnu99) used by gcc 5+ to
workaround some build issues with C99.

Fixes:
http://autobuild.buildroot.net/results/ed8/ed840755e8e486e48eab8c13a8bb5e9a448199ce

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/expedite/expedite.mk | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas Petazzoni April 22, 2017, 12:42 p.m. UTC | #1
Hello,

On Fri, 21 Apr 2017 23:31:04 +0200, Romain Naour wrote:

> +# The code use for loop initial declarations which are only allowed in
> +# C99 mode. Use the default compiler version (gnu99) used by gcc 5+ to
> +# workaround some build issues with C99.
> +EXPEDITE_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -std=gnu99"

What is the full command line used by expedite to build its C files?
Gcc 5.x uses -std=c11 by default, and C11 apparently accepts definition
of variables inside the initialization part of for() loops. So it seems
like expedite is overriding the default -std= GCC option with its
own...

Or maybe it's the configure.ac AC_PROG_CC that does this by default?
Anyway, it's worth checking and doing something upstreamable rather
than working around in the .mk file.

Best regards,

Thomas
Romain Naour April 29, 2017, 10:41 a.m. UTC | #2
Hi Thomas,

Le 22/04/2017 à 14:42, Thomas Petazzoni a écrit :
> Hello,
> 
> On Fri, 21 Apr 2017 23:31:04 +0200, Romain Naour wrote:
> 
>> +# The code use for loop initial declarations which are only allowed in
>> +# C99 mode. Use the default compiler version (gnu99) used by gcc 5+ to
>> +# workaround some build issues with C99.
>> +EXPEDITE_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
> 
> What is the full command line used by expedite to build its C files?
> Gcc 5.x uses -std=c11 by default, and C11 apparently accepts definition
> of variables inside the initialization part of for() loops. So it seems
> like expedite is overriding the default -std= GCC option with its
> own...
> 
> Or maybe it's the configure.ac AC_PROG_CC that does this by default?
> Anyway, it's worth checking and doing something upstreamable rather
> than working around in the .mk file.

The build system doesn't override the default C language version, it just use
the one used by default by the compiler.
The definition of variables inside the initialization part of for() loops was
added by the latest commit without adding c99 or gnu99 in the cflags.

I used a gcc5 based toolchain while I tested this version of expedite, that's
why I didn't had any issue.

Another easy solution is to not use definition of variables inside the
initialization part of for() loops.

Best regards,
Romain

> 
> Best regards,
> 
> Thomas
>
diff mbox

Patch

diff --git a/package/expedite/expedite.mk b/package/expedite/expedite.mk
index d49e87a..9aa6a4a 100644
--- a/package/expedite/expedite.mk
+++ b/package/expedite/expedite.mk
@@ -15,6 +15,11 @@  EXPEDITE_DEPENDENCIES = host-efl host-pkgconf efl
 # There is no configure script in the git tree.
 EXPEDITE_AUTORECONF = YES
 
+# The code use for loop initial declarations which are only allowed in
+# C99 mode. Use the default compiler version (gnu99) used by gcc 5+ to
+# workaround some build issues with C99.
+EXPEDITE_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
+
 ifeq ($(BR2_PACKAGE_EFL_X_XLIB),y)
 EXPEDITE_CONF_OPTS += --with-x=$(STAGING_DIR) \
 	--x-includes=$(STAGING_DIR)/usr/include \