• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/janus-gateway/0002-Add-test-for-Wunused-but-set-variable.patch
Bernd KuhlsBernd Kuhls committed eed8c2e38e805 Jun 2016
Raw file
Source viewDiff to previous
 
1
From c0f075bdee5edabf8f19b68e0880fbd249a89653 Mon Sep 17 00:00:00 2001
2
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3
Date: Sat, 3 Jan 2015 15:09:59 +0100
4
Subject: [PATCH] Add test for -Wunused-but-set-variable
5
​
6
The -Wunused-but-set-variable option does not exist in some old gcc
7
versions (gcc 4.5.x), so using it unconditionally breaks the build
8
with such compilers.
9
​
10
This commit introduces the AX_CHECK_COMPILE_FLAG m4 macro taken from
11
the autoconf-archive
12
(http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4),
13
and uses it to detect if the -Wunused-but-set-variable option is
14
supported, and only uses it in this case.
15
​
16
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17
(rebased against v0.1.0)
18
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
19
---
20
 Makefile.am                 |  2 +-
21
 configure.ac                |  3 ++
22
 m4/ax_check_compile_flag.m4 | 74 +++++++++++++++++++++++++++++++++++++++++++++
23
 3 files changed, 78 insertions(+), 1 deletion(-)
24
 create mode 100644 m4/ax_check_compile_flag.m4
25
​
26
diff --git a/Makefile.am b/Makefile.am
27
index 5d23e0b..0f51f6a 100644
28
--- a/Makefile.am
29
+++ b/Makefile.am
30
@@ -6,7 +6,7 @@ AM_CFLAGS = \
31
    -Wnested-externs -Wstrict-prototypes -Wunsafe-loop-optimizations \
32
    -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter \
33
    -Wcast-align -Wformat-nonliteral -Wformat-security -Wswitch-default \
34
-   -Wmissing-include-dirs -Wno-aggregate-return -Wunused-but-set-variable \
35
+   -Wmissing-include-dirs -Wno-aggregate-return @GCC_WARN_UNUSED_BUT_SET@ \
36
    -Warray-bounds -Wold-style-definition -Wsign-compare -Wlarger-than=65537
37
 AM_CFLAGS += -Wno-undef  # sophiasip is not -Wundef--safe
38
 AM_CFLAGS += -Wno-redundant-decls  # sophiasip also contains redundant declarations
39
diff --git a/configure.ac b/configure.ac
40
index 17870a7..f9bb1e4 100644
41
--- a/configure.ac
42
+++ b/configure.ac
43
@@ -7,6 +7,9 @@ AM_SILENT_RULES([yes])
44
 AC_GNU_SOURCE
45
 
46
 AC_PROG_CC
47
+AX_CHECK_COMPILE_FLAG([-Wunused-but-set-variable],
48
+   [GCC_WARN_UNUSED_BUT_SET=-Wunused-but-set-variable])
49
+AC_SUBST(GCC_WARN_UNUSED_BUT_SET)
50
 
51
 LT_PREREQ([2.2])
52
 LT_INIT
53
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
54
new file mode 100644
55
index 0000000..51df0c0
56
--- /dev/null
57
+++ b/m4/ax_check_compile_flag.m4
58
@@ -0,0 +1,74 @@
59
+# ===========================================================================
60
+#   http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
61
+# ===========================================================================
62
+#
63
+# SYNOPSIS
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.