diff options
author | Roy Li <rongqing.li@windriver.com> | 2015-09-14 17:23:32 +0800 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2015-09-14 15:58:50 -0400 |
commit | 4285293a316aeb17fc53a9954efe800a142ef141 (patch) | |
tree | 7a1599936440ce26ba93ddfa71640d829c1a40ea | |
parent | 8c14c253299a95d953e25149d04e454e9ddf1b88 (diff) | |
download | meta-openembedded-4285293a316aeb17fc53a9954efe800a142ef141.tar.gz |
lldap: fix the building failure when gcc5 is used or DEBUG_BUILD is 1
1. fix the building failure when host is gcc5
2. fix the building failure when DEBUG_BUILD is 1 by removal of -Werror
Remove -Werror, since it is suitable to develop only; otherwise when
gcc adds -O0 option to compile codes, the error will be generated
since the warning:
//# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r-- | meta-networking/recipes-daemons/lldpad/lldpad/0001-get-inline-functions-work-with-both-gnu11-and-gnu89.patch | 99 | ||||
-rw-r--r-- | meta-networking/recipes-daemons/lldpad/lldpad_0.9.46.bb | 8 |
2 files changed, 106 insertions, 1 deletions
diff --git a/meta-networking/recipes-daemons/lldpad/lldpad/0001-get-inline-functions-work-with-both-gnu11-and-gnu89.patch b/meta-networking/recipes-daemons/lldpad/lldpad/0001-get-inline-functions-work-with-both-gnu11-and-gnu89.patch new file mode 100644 index 000000000..9ff7c0f8f --- /dev/null +++ b/meta-networking/recipes-daemons/lldpad/lldpad/0001-get-inline-functions-work-with-both-gnu11-and-gnu89.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | From 67399dcc2575c0e9c64fc77354f9653127cddf64 Mon Sep 17 00:00:00 2001 | ||
2 | From: Roy Li <rongqing.li@windriver.com> | ||
3 | Date: Mon, 14 Sep 2015 17:07:26 +0800 | ||
4 | Subject: [PATCH] get inline functions work with both gnu11 and gnu89 | ||
5 | |||
6 | Upstream-status: Pending | ||
7 | |||
8 | After gcc upgraded to gcc5, and if the codes are compiled without optimization(-O0), | ||
9 | and the below error will happen: | ||
10 | |||
11 | ./include/lldp_8021qaz.h:237:12: error: inline function 'ieee8021qaz_clif_cmd' declared but never defined [-Werror] | ||
12 | inline int ieee8021qaz_clif_cmd(void *data, struct sockaddr_un *from, | ||
13 | ^ | ||
14 | ./include/lldp_8021qaz.h:222:13: error: inline function 'set_prio_map' declared but never defined [-Werror] | ||
15 | inline void set_prio_map(u32 *prio_map, u8 prio, int tc); | ||
16 | ^ | ||
17 | ./include/lldp_8021qaz.h:221:12: error: inline function 'get_prio_map' declared but never defined [-Werror] | ||
18 | inline int get_prio_map(u32 prio_map, int tc); | ||
19 | |||
20 | gcc5 defaults to -std=gnu11 instead of -std=gnu89, and it requires that exactly one C | ||
21 | source file has the callable copy of the inline function. Consider the following | ||
22 | program: | ||
23 | |||
24 | inline int | ||
25 | foo (void) | ||
26 | { | ||
27 | return 42; | ||
28 | } | ||
29 | |||
30 | int | ||
31 | main (void) | ||
32 | { | ||
33 | return foo (); | ||
34 | } | ||
35 | |||
36 | The program above will not link with the C99 inline semantics, because no out-of-line | ||
37 | function foo is generated. To fix this, either mark the function foo as static, or | ||
38 | add the following declaration: | ||
39 | static inline int foo (void); | ||
40 | |||
41 | more information refer to: https://gcc.gnu.org/gcc-5/porting_to.html; | ||
42 | |||
43 | but the use of "extern inline" will lead to the compilation issue if gcc is not | ||
44 | gcc5, so replace inline with "static inline" | ||
45 | |||
46 | Signed-off-by: Roy Li <rongqing.li@windriver.com> | ||
47 | --- | ||
48 | include/lldp_8021qaz.h | 5 ----- | ||
49 | lldp_8021qaz.c | 4 ++-- | ||
50 | 2 files changed, 2 insertions(+), 7 deletions(-) | ||
51 | |||
52 | diff --git a/include/lldp_8021qaz.h b/include/lldp_8021qaz.h | ||
53 | index 55353b8..d321625 100644 | ||
54 | --- a/include/lldp_8021qaz.h | ||
55 | +++ b/include/lldp_8021qaz.h | ||
56 | @@ -218,8 +218,6 @@ int ieee8021qaz_mod_app(struct app_tlv_head *head, int peer, | ||
57 | u8 prio, u8 sel, u16 proto, u32 ops); | ||
58 | int ieee8021qaz_app_sethw(char *ifname, struct app_tlv_head *head); | ||
59 | |||
60 | -inline int get_prio_map(u32 prio_map, int tc); | ||
61 | -inline void set_prio_map(u32 *prio_map, u8 prio, int tc); | ||
62 | |||
63 | struct ieee8021qaz_tlvs *ieee8021qaz_data(const char *); | ||
64 | |||
65 | @@ -234,9 +232,6 @@ int ieee8021qaz_rchange(struct port *port, struct lldp_agent *, | ||
66 | void ieee8021qaz_ifup(char *ifname, struct lldp_agent *); | ||
67 | void ieee8021qaz_ifdown(char *ifname, struct lldp_agent *); | ||
68 | u8 ieee8021qaz_mibDeleteObject(struct port *port, struct lldp_agent *); | ||
69 | -inline int ieee8021qaz_clif_cmd(void *data, struct sockaddr_un *from, | ||
70 | - socklen_t fromlen, char *ibuf, int ilen, | ||
71 | - char *rbuf); | ||
72 | int ieee8021qaz_check_operstate(void); | ||
73 | int get_dcbx_hw(const char *ifname, __u8 *dcbx); | ||
74 | |||
75 | diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c | ||
76 | index 094676d..f154317 100644 | ||
77 | --- a/lldp_8021qaz.c | ||
78 | +++ b/lldp_8021qaz.c | ||
79 | @@ -396,7 +396,7 @@ static int read_cfg_file(char *ifname, struct lldp_agent *agent, | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | -inline int get_prio_map(u32 prio_map, int prio) | ||
84 | +static inline int get_prio_map(u32 prio_map, int prio) | ||
85 | { | ||
86 | if (prio > 7) | ||
87 | return 0; | ||
88 | @@ -404,7 +404,7 @@ inline int get_prio_map(u32 prio_map, int prio) | ||
89 | return (prio_map >> (4 * (7-prio))) & 0xF; | ||
90 | } | ||
91 | |||
92 | -inline void set_prio_map(u32 *prio_map, u8 prio, int tc) | ||
93 | +static inline void set_prio_map(u32 *prio_map, u8 prio, int tc) | ||
94 | { | ||
95 | u32 mask = ~(0xffffffff & (0xF << (4 * (7-prio)))); | ||
96 | *prio_map &= mask; | ||
97 | -- | ||
98 | 1.9.1 | ||
99 | |||
diff --git a/meta-networking/recipes-daemons/lldpad/lldpad_0.9.46.bb b/meta-networking/recipes-daemons/lldpad/lldpad_0.9.46.bb index 8c44a3e5c..0c8c5d852 100644 --- a/meta-networking/recipes-daemons/lldpad/lldpad_0.9.46.bb +++ b/meta-networking/recipes-daemons/lldpad/lldpad_0.9.46.bb | |||
@@ -8,12 +8,18 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8c2bc283e65df398ced5f5b747e78162" | |||
8 | DEPENDS = "libconfig libnl" | 8 | DEPENDS = "libconfig libnl" |
9 | SRCREV = "48a5f38778b18d6659a672ccb4640f25c6720827" | 9 | SRCREV = "48a5f38778b18d6659a672ccb4640f25c6720827" |
10 | 10 | ||
11 | SRC_URI = "git://github.com/jrfastab/lldpad.git;protocol=http" | 11 | SRC_URI = "git://github.com/jrfastab/lldpad.git;protocol=http \ |
12 | file://0001-get-inline-functions-work-with-both-gnu11-and-gnu89.patch \ | ||
13 | " | ||
12 | 14 | ||
13 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
14 | 16 | ||
15 | inherit autotools-brokensep pkgconfig systemd | 17 | inherit autotools-brokensep pkgconfig systemd |
16 | 18 | ||
19 | do_configure_prepend() { | ||
20 | sed -i "s:-Werror::g" ${S}/Makefile.am | ||
21 | } | ||
22 | |||
17 | do_install_append () { | 23 | do_install_append () { |
18 | install -m 0755 -d ${D}${systemd_unitdir} | 24 | install -m 0755 -d ${D}${systemd_unitdir} |
19 | mv ${D}${prefix}${systemd_unitdir}/* ${D}${systemd_unitdir}/ | 25 | mv ${D}${prefix}${systemd_unitdir}/* ${D}${systemd_unitdir}/ |