Skip to contentSkip to conversation

package/janus-gateway: fix compilation with older gcc versions

PATCH New Yann E. MORIN 2 participants 3 messages Jan 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/janus-gateway: fix compilation with older gcc versions

janus-gateway forcibly uses -Wunused-but-set-variable, which is not available for all gcc versions. For example, gcc-4.5, as used in Sourcery CodeBench PowerPC 2011.03, does not have it.

Fixes:

    http://autobuild.buildroot.org/results/6d8/6d8e15ac5d592a51b6a8d2ceb9fc1ca954428ed7/
    http://autobuild.buildroot.org/results/abe/abe25b588bf6de0d76cce0135841d65dc66d5cca/
    [...]
---
 package/janus-gateway/0002-no-unused-but-set.patch | 20 ++++++++++++++++++++
 package/janus-gateway/janus-gateway.mk             |  1 +
 2 files changed, 21 insertions(+)
 create mode 100644 package/janus-gateway/0002-no-unused-but-set.patch
package/janus-gateway/0002-no-unused-but-set.patch new file +20 -0
new file mode 100644
index 0000000..652a73f
@@ -0,0 +1,20 @@
+Makefile: do not forcibly pass -Wunused-but-set-variable
+
+Not all versions of gcc support that warning; for example, gcc 4.5
+does not, but is still widely used.
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+Cc: Gregory Dymarek <[email protected]>
+
+diff -durN a/Makefile.am b/Makefile.am
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -6,7 +6,7 @@
+ 	-Wnested-externs -Wstrict-prototypes -Wunsafe-loop-optimizations \
+ 	-Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter \
+ 	-Wcast-align -Wformat-nonliteral -Wformat-security -Wswitch-default \
+-	-Wmissing-include-dirs -Waggregate-return -Wunused-but-set-variable \
++	-Wmissing-include-dirs -Waggregate-return \
+ 	-Warray-bounds -Wold-style-definition -Wsign-compare -Wlarger-than=65537
+ AM_CFLAGS += -Wno-undef  # sophiasip is not -Wundef--safe
+ AM_CFLAGS += -Wredundant-decls  # sophiasip also contains redundant declarations
package/janus-gateway/janus-gateway.mk +1 -0
index 6c89e9a..47cf499 100644
@@ -14,6 +14,7 @@ JANUS_GATEWAY_DEPENDENCIES = host-pkgconf libmicrohttpd jansson \
 	libnice sofia-sip libsrtp host-gengetopt openssl ding-libs
 
 # Straight out of the repository, no ./configure
+# We also touch Makefile.am anyway.
 JANUS_GATEWAY_AUTORECONF = YES
 
 define JANUS_GATEWAY_M4
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 package/janus-gateway: fix compilation with older gcc versions

Dear Yann E. MORIN,

Quoted 11 lines · Yann E. MORIN

janus-gateway forcibly uses -Wunused-but-set-variable, which is not available for all gcc versions. For example, gcc-4.5, as used in Sourcery CodeBench PowerPC 2011.03, does not have it.

Fixes:

    http://autobuild.buildroot.org/results/6d8/6d8e15ac5d592a51b6a8d2ceb9fc1ca954428ed7/
    http://autobuild.buildroot.org/results/abe/abe25b588bf6de0d76cce0135841d65dc66d5cca/
    [...]

I have an alternate version of this patch that does detect if -Wunused-but-set-variable is supported by gcc or not, and uses it only when available. I believe such a patch has a higher chance of being accepted upstream, no?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/janus-gateway: fix compilation with older gcc versions

Thomas, All,

On 2015-01-04 18:07 +0100, Thomas Petazzoni spake thusly:

Quoted 12 lines

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

janus-gateway forcibly uses -Wunused-but-set-variable, which is not available for all gcc versions. For example, gcc-4.5, as used in Sourcery CodeBench PowerPC 2011.03, does not have it.

Fixes:

    http://autobuild.buildroot.org/results/6d8/6d8e15ac5d592a51b6a8d2ceb9fc1ca954428ed7/
    http://autobuild.buildroot.org/results/abe/abe25b588bf6de0d76cce0135841d65dc66d5cca/
    [...]
Quoted 7 lines
Quoted 2 lines

I have an alternate version of this patch that does detect if -Wunused-but-set-variable is supported by gcc or not, and uses it only when available. I believe such a patch has a higher chance of being accepted upstream, no?

Yes, obviously. I'll mark my patch rejected in Patchwork, then.

Thanks!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'