Skip to contentSkip to conversation

kexecboot_0.6: fix build with gcc 5

PATCH In review Andrea Adami 2 participants 6 messages Sep 23, 2015 – Oct 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexecboot_0.6: fix build with gcc 5

Resolving the issue:

rgb.h:55:1: warning: inline function 'rgba2comp' declared but never defined

|  rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
|  ^

Fix C99 inline semantic as documented here:
https://gcc.gnu.org/gcc-5/porting_to.html

---
 .../files/0005-rgb.h-fix-build-with-gcc5.patch     | 34 ++++++++++++++++++++++
 .../recipes-bsp/kexecboot/kexecboot_0.6.bb         |  2 ++
 2 files changed, 36 insertions(+)
 create mode 100644 meta-initramfs/recipes-bsp/kexecboot/files/0005-rgb.h-fix-build-with-gcc5.patch
meta-initramfs/recipes-bsp/kexecboot/files/0005-rgb.h-fix-build-with-gcc5.patch new file +34 -0
new file mode 100644
index 0000000..e451435
@@ -0,0 +1,34 @@
+From b2c4fc69868a4831ec798ad98f5e7fce200cf0e3 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <[email protected]>
+Date: Thu, 24 Sep 2015 00:02:48 +0200
+Subject: [PATCH] rgb.h: fix build with gcc 5 (C99 inline semantic)
+
+Building with gcc 5.2 we trigger the following error:
+
+rgb.h:55:1: warning: inline function 'rgba2comp' declared but never defined
+|  rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
+|  ^
+
+https://gcc.gnu.org/gcc-5/porting_to.html
+
+Signed-off-by: Andrea Adami <[email protected]>
+---
+ rgb.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/rgb.h b/rgb.h
+index 0ba987a..4f64622 100644
+--- a/rgb.h
++++ b/rgb.h
+@@ -51,7 +51,7 @@ typedef struct {
+ } kx_named_color;
+ 
+ /* Convert RGBA uint32 to red/green/blue/alpha components */
+-inline void
++extern inline void
+ rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
+ 		kx_ccomp *blue, kx_ccomp *alpha);
+ 
+-- 
+1.9.1
+
meta-initramfs/recipes-bsp/kexecboot/kexecboot_0.6.bb +2 -0
index 9061c27..3397c29 100644
@@ -47,6 +47,8 @@ SRC_URI += "\
             file://0002-kexecboot-fix-configure-warnings.patch \
             file://0003-kexecboot-do-not-hardcode-MOUNTPOINT.patch \
             file://0004-kexecboot.c-workaround-for-absolute-kernel-and-initr.patch \
+            \
+            file://0005-rgb.h-fix-build-with-gcc5.patch \
             "
 
 inherit autotools
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Andrea Adami

+-inline void
++extern inline void

would it be better to make it static inline ?

#2 lore raw
Quoted 7 lines · Khem Raj
Quoted 2 lines · Andrea Adami

+-inline void
++extern inline void

would it be better to make it static inline ?

Apparently not...

rgba2comp is used in rgb.c and fb.c.
Making it static inline leads to the following error:

| In file included from /tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.h:39:0,
| from
/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/gui.h:25,
| from
/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/kexecboot.c:43:
| /tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/rgb.h:55:1:
warning: 'rgba2comp' declared 'static' but never defined [-Wunused-function]

|  rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
|  ^
| arm-oe-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork

--sysroot=/tmp/build/tmp-glibc/sysroots/poodle -Wall -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o kexecboot util.o cfgparser.o devicescan.o evdevs.o fb.o gui.o menu.o xpm.o rgb.o tui.o kexecboot.o fstype/fstype.o machine/zaurus.o | fb.o: In function `compose_color':
| /tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.c:34:
undefined reference to `rgba2comp'
| collect2: error: ld returned 1 exit status

BTW, I didn't test that patch compiling with gcc 4 yet. It is just meant as a fix for gcc 5 w/out touching much code.
Thanks for your review, suggestions are appreciated!

Cheers
Andrea

#3 lore raw
Quoted 11 lines · Andrea Adami
Quoted 7 lines · Khem Raj
Quoted 2 lines · Andrea Adami

+-inline void
++extern inline void

would it be better to make it static inline ?

Apparently not...

well I meant to move the defintion of this function to header and not just modify the declaration.

Quoted 37 lines

rgba2comp is used in rgb.c and fb.c.
Making it static inline leads to the following error:

| In file included from /tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.h:39:0,
| from
/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/gui.h:25,
| from
/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/kexecboot.c:43:
| /tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/rgb.h:55:1:
warning: 'rgba2comp' declared 'static' but never defined [-Wunused-function]

|  rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
|  ^
| arm-oe-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork

--sysroot=/tmp/build/tmp-glibc/sysroots/poodle -Wall -O2 -pipe -g

(quoted diff) +0 -2
-feliminate-unused-debug-types  -Wl,-O1 -Wl,--hash-style=gnu
-Wl,--as-needed -o kexecboot util.o cfgparser.o devicescan.o evdevs.o fb.o

gui.o menu.o xpm.o rgb.o tui.o kexecboot.o fstype/fstype.o machine/zaurus.o | fb.o: In function `compose_color':
| /tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.c:34:
undefined reference to `rgba2comp'
| collect2: error: ld returned 1 exit status

BTW, I didn't test that patch compiling with gcc 4 yet. It is just meant as a fix for gcc 5 w/out touching much code.
Thanks for your review, suggestions are appreciated!

Cheers
Andrea
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#4 lore raw
Quoted 9 lines · Khem Raj
Quoted 7 lines · Andrea Adami
Quoted 5 lines · Khem Raj
Quoted 2 lines · Andrea Adami

+-inline void
++extern inline void

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

would it be better to make it static inline ?

Apparently not...

well I meant to move the defintion of this function to header and not just modify the declaration.

Khem,

what do you think if I simply modify the declaration from inline void to void? There is a single definition and it uses inline.

Declaration in rgb.h
+ /* Convert RGBA uint32 to red/green/blue/alpha components */ +-inline void
++void
+ rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
+ kx_ccomp *blue, kx_ccomp *alpha);

Definition in rgb.c is
....
#include "rgb.h"
#include "rgbtab.h"

inline void
rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green, kx_ccomp *blue, kx_ccomp *alpha)

{
        *alpha = (kx_ccomp) (rgba & 0x000000FF);
        *blue =  (kx_ccomp)((rgba & 0x0000FF00) >> 8);
        *green = (kx_ccomp)((rgba & 0x00FF0000) >> 16);
        *red =   (kx_ccomp)((rgba & 0xFF000000) >> 24);
}

It compiles and if I understand correctly the function will be callable from other files. Do you see any drawbacks? This would be a minimal change for upstream.

About 'static inline' I think I get what you mean but please note the function is only used in one source file so I guess I could just define it 'static inline' there (or in a header if it would be used more than once ). Do you suggest to modify all the occurrences in the sources?

Thanks in advance
Andrea

Quoted 52 lines
Quoted 6 lines

rgba2comp is used in rgb.c and fb.c.
Making it static inline leads to the following error:

| In file included from

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.h:39:0,

Quoted 2 lines

| from

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/gui.h:25,

Quoted 2 lines

| from

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/kexecboot.c:43:

Quoted 2 lines

|

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/rgb.h:55:1:

Quoted 1 line

warning: 'rgba2comp' declared 'static' but never defined

[-Wunused-function]

Review

Quoted 6 lines
|  rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
|  ^
| arm-oe-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork

--sysroot=/tmp/build/tmp-glibc/sysroots/poodle -Wall -O2 -pipe -g

(quoted diff) +0 -2
-feliminate-unused-debug-types  -Wl,-O1 -Wl,--hash-style=gnu
-Wl,--as-needed -o kexecboot util.o cfgparser.o devicescan.o evdevs.o

fb.o

Quoted 1 line

gui.o menu.o xpm.o rgb.o tui.o kexecboot.o fstype/fstype.o

machine/zaurus.o

Quoted 3 lines

| fb.o: In function `compose_color':
|

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.c:34:

Quoted 4 lines

undefined reference to `rgba2comp'
| collect2: error: ld returned 1 exit status

BTW, I didn't test that patch compiling with gcc 4 yet. It is just meant

as

Quoted 10 lines

a fix for gcc 5 w/out touching much code. Thanks for your review, suggestions are appreciated!

Cheers
Andrea
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#5 lore raw
Quoted 47 lines · Andrea Adami
Quoted 9 lines · Khem Raj
Quoted 7 lines · Andrea Adami
Quoted 5 lines · Khem Raj
Quoted 2 lines · Andrea Adami

+-inline void
++extern inline void

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

would it be better to make it static inline ?

Apparently not...

well I meant to move the defintion of this function to header and not just modify the declaration.

Khem,

what do you think if I simply modify the declaration from inline void to void? There is a single definition and it uses inline.

Declaration in rgb.h
+ /* Convert RGBA uint32 to red/green/blue/alpha components */ +-inline void
++void
+ rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
+ kx_ccomp *blue, kx_ccomp *alpha);

Definition in rgb.c is
....
#include "rgb.h"
#include "rgbtab.h"

inline void
rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green, kx_ccomp *blue, kx_ccomp *alpha)

{
        *alpha = (kx_ccomp) (rgba & 0x000000FF);
        *blue =  (kx_ccomp)((rgba & 0x0000FF00) >> 8);
        *green = (kx_ccomp)((rgba & 0x00FF0000) >> 16);
        *red =   (kx_ccomp)((rgba & 0xFF000000) >> 24);
}
Quoted 9 lines

It compiles and if I understand correctly the function will be callable from other files. Do you see any drawbacks? This would be a minimal change for upstream.

About 'static inline' I think I get what you mean but please note the function is only used in one source file so I guess I could just define it 'static inline' there (or in a header if it would be used more than once ). Do you suggest to modify all the occurrences in the sources?

remove the declaration from header if its only used in one source file. and make the one in source file as static inline is the function definition in same file as its use ?

Quoted 62 lines

Thanks in advance
Andrea

Quoted 46 lines
Quoted 6 lines

rgba2comp is used in rgb.c and fb.c.
Making it static inline leads to the following error:

| In file included from

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.h:39:0,

Quoted 2 lines

| from

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/gui.h:25,

Quoted 2 lines

| from

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/kexecboot.c:43:

Quoted 2 lines

|

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/rgb.h:55:1:

Quoted 1 line

warning: 'rgba2comp' declared 'static' but never defined

[-Wunused-function]

Review

Quoted 6 lines
|  rgba2comp(kx_rgba rgba, kx_ccomp *red, kx_ccomp *green,
|  ^
| arm-oe-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork

--sysroot=/tmp/build/tmp-glibc/sysroots/poodle -Wall -O2 -pipe -g

(quoted diff) +0 -2
-feliminate-unused-debug-types  -Wl,-O1 -Wl,--hash-style=gnu
-Wl,--as-needed -o kexecboot util.o cfgparser.o devicescan.o evdevs.o

fb.o

Quoted 1 line

gui.o menu.o xpm.o rgb.o tui.o kexecboot.o fstype/fstype.o

machine/zaurus.o

Quoted 3 lines

| fb.o: In function `compose_color':
|

/tmp/build/tmp-glibc/work/poodle-oe-linux-gnueabi/kexecboot/0.6-r0/kexecboot-0.6/fb.c:34:

Quoted 4 lines

undefined reference to `rgba2comp'
| collect2: error: ld returned 1 exit status

BTW, I didn't test that patch compiling with gcc 4 yet. It is just meant

as

Quoted 10 lines

a fix for gcc 5 w/out touching much code. Thanks for your review, suggestions are appreciated!

Cheers
Andrea
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Quoted 6 lines

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel