Skip to content
Snippets Groups Projects
Commit 32c18bf5 authored by Simon McVittie's avatar Simon McVittie
Browse files

Merge branch 'wip/smcv/warn-more' into 'master'

Enable and squash compiler warnings

See merge request steam/pressure-vessel!11
parents 5a0a491e 1feb3f64
No related branches found
No related tags found
No related merge requests found
#define _GNU_SOURCE
#define G_LOG_DOMAIN "pressure-vessel"
#mesondefine VERSION
#include "subprojects/libglnx/config.h"
......@@ -50,13 +50,28 @@ build:devel:
- |
set -eux
apt-get -y --no-install-recommends install \
clang \
clang-tools \
${NULL+}
git clone \
-b${STEAM_RUNTIME_TOOLS_GIT_BRANCH} \
${STEAM_RUNTIME_TOOLS_GIT_REPO} \
subprojects/steam-runtime-tools
meson _build
meson --werror _build
ninja -C _build
ninja -C _build install
meson test --verbose -C _build
export CC=clang
export CXX=clang++
rm -fr _build
meson --werror _build
ninja -C _build
ninja -C _build scan-build
ninja -C _build install
meson test --verbose -C _build
......@@ -103,6 +118,7 @@ build:scout:
--prefix="$(pwd)/_build/prefix" \
-Dpython=python3.5 \
-Dsrcdir=src \
--werror \
_build
ninja -C _build
meson test --verbose -C _build
......
......@@ -7,6 +7,12 @@ export LC_ALL=C.UTF-8
include /usr/share/dpkg/default.mk
meson_options =
ifeq ($(DEB_DISTRIBUTION),UNRELEASED)
meson_options += --werror
endif
%:
dh $@
......@@ -30,6 +36,7 @@ override_dh_auto_configure:
-Dpython=/usr/bin/$$python \
-Dsrcdir=src \
-Dversion=$(DEB_VERSION) \
$(meson_options) \
; then \
cat _build/meson-logs/meson-log.txt; \
exit 1; \
......
......@@ -21,7 +21,12 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
project('pressure-vessel', 'c')
project(
'pressure-vessel', 'c',
default_options: [
'warning_level=2',
],
)
prove = find_program('prove', required : false)
python = find_program(get_option('python'), required : true)
......@@ -43,7 +48,6 @@ warning_cflags = [
'-Wextra',
'-Warray-bounds',
'-Wcast-align',
'-Wdeclaration-after-statement',
'-Wdouble-promotion',
'-Wduplicated-branches',
'-Wduplicated-cond',
......@@ -52,7 +56,6 @@ warning_cflags = [
'-Wformat=2',
'-Wimplicit-function-declaration',
'-Winit-self',
'-Winline',
'-Wjump-misses-init',
'-Wlogical-op',
'-Wmissing-declarations',
......@@ -78,10 +81,13 @@ warning_cflags = [
'-Wwrite-strings',
]
no_warning_cflags = [
'cast-align',
'declaration-after-statement',
'missing-field-initializers',
'pedantic',
'sign-compare',
'unused-parameter',
'variadic-macros',
]
# This trips some warnings in the libglnx subproject but not in
# pressure-vessel itself
......@@ -150,9 +156,13 @@ conf_data.set_quoted('VERSION', version)
configure_file(
input : 'config.h.in',
output : 'config.h',
output : '_pressure-vessel-config.h',
configuration : conf_data,
)
add_project_arguments(
['-include', '_pressure-vessel-config.h'],
language : 'c',
)
executable(
'pressure-vessel-wrap',
......
......@@ -17,9 +17,6 @@
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include <ftw.h>
#include <gio/gio.h>
......
......@@ -18,9 +18,6 @@
* Alexander Larsson <alexl@redhat.com>
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
......
......@@ -20,9 +20,6 @@
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include "flatpak-run-private.h"
#include <sys/utsname.h>
......@@ -395,7 +392,6 @@ gboolean
flatpak_run_add_system_dbus_args (FlatpakBwrap *app_bwrap)
{
const char *dbus_address = g_getenv ("DBUS_SYSTEM_BUS_ADDRESS");
g_autofree char *real_dbus_address = NULL;
g_autofree char *dbus_system_socket = NULL;
if (dbus_address != NULL)
......
......@@ -20,9 +20,6 @@
* Alexander Larsson <alexl@redhat.com>
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include "flatpak-utils-private.h"
#include <string.h>
......@@ -40,6 +37,10 @@
#include <sys/ioctl.h>
#include <termios.h>
/* To keep this more similar to the original file, we explicitly disable
* this warning rather than fixing it */
#pragma GCC diagnostic ignored "-Wshadow"
#define RUNNING_ON_VALGRIND 0
/* Sometimes this is /var/run which is a symlink, causing weird issues when we pass
......
......@@ -22,7 +22,6 @@
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "glib-backports.h"
#include <errno.h>
......
......@@ -23,8 +23,6 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <errno.h>
#include <getopt.h>
#include <locale.h>
......
......@@ -20,8 +20,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include "utils.h"
#include <glib.h>
......
......@@ -17,9 +17,6 @@
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include "wrap-interactive.h"
#include <fcntl.h>
......
......@@ -22,9 +22,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "subprojects/libglnx/config.h"
#include <glib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
......@@ -103,7 +100,6 @@ find_bwrap (const char *tools_dir)
};
const char *tmp;
g_autofree gchar *candidate = NULL;
g_autofree gchar *dirname = NULL;
gsize i;
g_return_val_if_fail (tools_dir != NULL, NULL);
......@@ -671,7 +667,6 @@ bind_runtime (FlatpakBwrap *bwrap,
NULL
};
g_autofree gchar *xrd = g_strdup_printf ("/run/user/%ld", (long) geteuid ());
g_autofree gchar *usr = NULL;
gsize i, j;
const gchar *member;
g_autoptr(GString) dri_path = g_string_new ("");
......@@ -697,8 +692,6 @@ bind_runtime (FlatpakBwrap *bwrap,
g_return_val_if_fail (scratch != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
usr = g_build_filename (runtime, "usr", NULL);
if (!pv_bwrap_bind_usr (bwrap, runtime, "/", error))
return FALSE;
......@@ -1445,21 +1438,21 @@ bind_runtime (FlatpakBwrap *bwrap,
*/
if (g_file_test ("/etc/localtime", G_FILE_TEST_EXISTS))
{
g_autofree char *localtime = NULL;
g_autofree char *target = NULL;
gboolean is_reachable = FALSE;
g_autofree char *timezone = flatpak_get_timezone ();
g_autofree char *timezone_content = g_strdup_printf ("%s\n", timezone);
g_autofree char *tz = flatpak_get_timezone ();
g_autofree char *timezone_content = g_strdup_printf ("%s\n", tz);
localtime = glnx_readlinkat_malloc (-1, "/etc/localtime", NULL, NULL);
target = glnx_readlinkat_malloc (-1, "/etc/localtime", NULL, NULL);
if (localtime != NULL)
if (target != NULL)
{
g_autoptr(GFile) base_file = NULL;
g_autoptr(GFile) target_file = NULL;
g_autofree char *target_canonical = NULL;
base_file = g_file_new_for_path ("/etc");
target_file = g_file_resolve_relative_path (base_file, localtime);
target_file = g_file_resolve_relative_path (base_file, target);
target_canonical = g_file_get_path (target_file);
is_reachable = g_str_has_prefix (target_canonical, "/usr/");
......@@ -1468,7 +1461,7 @@ bind_runtime (FlatpakBwrap *bwrap,
if (is_reachable)
{
flatpak_bwrap_add_args (bwrap,
"--symlink", localtime, "/etc/localtime",
"--symlink", target, "/etc/localtime",
NULL);
}
else
......@@ -2171,7 +2164,7 @@ main (int argc,
{
g_autofree gchar *quoted = g_shell_quote (env[i]);
g_message ("\t%s", env[i]);
g_message ("\t%s", quoted);
}
g_message ("Wrapped command:");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment