]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Add warning flags where they are missing and fix the resulting warnings
authorRobert Ancell <robert.ancell@canonical.com>
Thu, 6 Feb 2014 15:35:02 +0000 (15:35 +0000)
committerRobert Ancell <robert.ancell@canonical.com>
Thu, 6 Feb 2014 15:35:02 +0000 (15:35 +0000)
configure.ac
liblightdm-qt/Makefile.am
src/Makefile.am
src/dm-tool.c
tests/src/Makefile.am
tests/src/libsystem.c

index 4c0d0895fa3f370e942639afef94941d4c94bd12..0ee9b54ef3d339b0eeee412f6030d2b6d8e77039 100644 (file)
@@ -23,8 +23,10 @@ if test "x$GCC" == xyes; then
                  -Werror=format-security \
                  -Werror=format=2 \
                  -Werror=missing-include-dirs"
+    WARN_CXXFLAGS="-Wall"
 fi
 AC_SUBST(WARN_CFLAGS)
+AC_SUBST(WARN_CXXFLAGS)
 
 GOBJECT_INTROSPECTION_CHECK(0.9.5)
 
index a333d9b8ee5afdf8db24875a4cdb8253f1e7c0d1..64bee23b1103b4800b826bbb83bc423c6d3ce57c 100644 (file)
@@ -9,6 +9,7 @@ liblightdm_qt5_3_la_LIBADD = \
        $(common_libadd)
 
 common_cflags = \
+       $(WARN_CXXFLAGS) \
        -I$(top_srcdir)/liblightdm-gobject \
        $(GLIB_CFLAGS) \
        -DQT_NO_KEYWORDS \
index fa3a20f42bbe3f193aa0402d714c5af3bb9a26e0..117eb137e869d9df899cad603494fb95872937fe 100644 (file)
@@ -78,8 +78,8 @@ lightdm_SOURCES = \
        xdmcp-session-private.h
 
 lightdm_CFLAGS = \
-       $(LIGHTDM_CFLAGS) \
        $(WARN_CFLAGS) \
+       $(LIGHTDM_CFLAGS) \
        -DSBIN_DIR=\"$(sbindir)\" \
        -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
        -DLOG_DIR=\"$(localstatedir)/log/lightdm\" \
@@ -99,6 +99,7 @@ dm_tool_SOURCES = \
        dm-tool.c
 
 dm_tool_CFLAGS = \
+       $(WARN_CFLAGS) \
        $(LIGHTDM_CFLAGS) \
        -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
        -DLOCALE_DIR=\"$(datadir)/locale\"
@@ -111,8 +112,8 @@ libexec_PROGRAMS = lightdm-guest-session
 lightdm_guest_session_SOURCES = lightdm-guest-session.c
 
 lightdm_guest_session_CFLAGS = \
-       $(LIGHTDM_CFLAGS) \
-       $(WARN_CFLAGS)
+       $(WARN_CFLAGS) \
+       $(LIGHTDM_CFLAGS)
 
 EXTRA_DIST = \
        display-manager.xml
index be9c93e94410c20a5bf75fa9d25b9ab7fa6d4079..ae16e7b4c36b2dde52080bbfa1e3df6e4386be66 100644 (file)
@@ -23,7 +23,7 @@ static gint xephyr_display_number;
 static GPid xephyr_pid;
 
 static void
-usage ()
+usage (void)
 {
     g_printerr (/* Text printed out when an unknown command-line argument provided */
                 _("Run 'dm-tool --help' to see a full list of available command line options."));
@@ -69,7 +69,7 @@ xephyr_signal_cb (int signum)
     exit (EXIT_SUCCESS);
 }
 
-GDBusProxy *
+static GDBusProxy *
 get_seat_proxy (void)
 {
     GError *error = NULL;
@@ -285,7 +285,7 @@ main (int argc, char **argv)
     }
     else if (strcmp (command, "list-seats") == 0)
     {
-        GVariant *seats, *sessions;
+        GVariant *seats;
         GVariantIter *seat_iter;
         gchar *seat_path;
 
index 0f5073990e355f99e40b45dce5c295607efc3f79..d650ba4320199aa996b64cb7f4da1d6ff57315a0 100644 (file)
@@ -19,6 +19,7 @@ noinst_LTLIBRARIES = libsystem.la
 
 libsystem_la_SOURCES = libsystem.c status.c status.h
 libsystem_la_CFLAGS = \
+       $(WARN_CFLAGS) \
        $(GLIB_CFLAGS) \
        $(GIO_UNIX_CFLAGS) \
        -DSRCDIR=\"$(abs_top_srcdir)\" \
@@ -160,6 +161,7 @@ test_qt5_greeter_SOURCES = $(common_qt_sources)
 nodist_test_qt4_greeter_SOURCES = test-qt4-greeter_moc4.cpp
 nodist_test_qt5_greeter_SOURCES = test-qt5-greeter_moc5.cpp
 common_qt_cflags = \
+       $(WARN_CXXFLAGS) \
        $(GLIB_CFLAGS) \
        $(GIO_UNIX_CFLAGS) \
        $(XCB_CFLAGS)
index 7a15dbad74612675066dd7e4e4109ceeb047eeae..d8e7be033725b00771dbd50d72762868f157bcfd 100644 (file)
@@ -1,16 +1,21 @@
+#define _GNU_SOURCE
+#define __USE_GNU
+
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/ioctl.h>
 #include <pwd.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <grp.h>
 #include <security/pam_appl.h>
 #include <fcntl.h>
-#define __USE_GNU
 #include <dlfcn.h>
+#include <utmpx.h>
 #ifdef __linux__
 #include <linux/vt.h>
 #endif
@@ -18,6 +23,8 @@
 #include <xcb/xcb.h>
 #include <gio/gunixsocketaddress.h>
 
+#include "status.h"
+
 #define LOGIN_PROMPT "login:"
 
 static int console_fd = -1;
@@ -154,9 +161,6 @@ setresuid (uid_t ruid, uid_t uuid, uid_t suid)
 static gchar *
 redirect_path (const gchar *path)
 {
-    size_t offset;
-    gboolean matches;
-
     // Don't redirect if inside the running directory
     if (g_str_has_prefix (path, g_getenv ("LIGHTDM_TEST_ROOT")))
         return g_strdup (path);
@@ -320,13 +324,13 @@ stat (const char *path, struct stat *buf)
 }
 
 int
-stat64 (const char *path, struct stat *buf)
+stat64 (const char *path, struct stat64 *buf)
 {
-    int (*_stat64) (const char *path, struct stat *buf);
+    int (*_stat64) (const char *path, struct stat64 *buf);
     gchar *new_path = NULL;
     int ret;
 
-    _stat64 = (int (*)(const char *path, struct stat *buf)) dlsym (RTLD_NEXT, "stat64");
+    _stat64 = (int (*)(const char *path, struct stat64 *buf)) dlsym (RTLD_NEXT, "stat64");
 
     new_path = redirect_path (path);
     ret = _stat64 (new_path, buf);
@@ -352,13 +356,13 @@ __xstat (int version, const char *path, struct stat *buf)
 }
 
 int
-__xstat64 (int version, const char *path, struct stat *buf)
+__xstat64 (int version, const char *path, struct stat64 *buf)
 {
-    int (*___xstat64) (int version, const char *path, struct stat *buf);
+    int (*___xstat64) (int version, const char *path, struct stat64 *buf);
     gchar *new_path = NULL;
     int ret;
   
-    ___xstat64 = (int (*)(int version, const char *path, struct stat *buf)) dlsym (RTLD_NEXT, "__xstat64");
+    ___xstat64 = (int (*)(int version, const char *path, struct stat64 *buf)) dlsym (RTLD_NEXT, "__xstat64");
 
     new_path = redirect_path (path);
     ret = ___xstat64 (version, new_path, buf);
@@ -432,25 +436,29 @@ chmod (const char *path, mode_t mode)
 }
 
 int
-ioctl (int d, int request, void *data)
+ioctl (int d, unsigned long request, ...)
 {
-    int (*_ioctl) (int d, int request, void *data);
+    int (*_ioctl) (int d, int request, ...);
 
-    _ioctl = (int (*)(int d, int request, void *data)) dlsym (RTLD_NEXT, "ioctl");
+    _ioctl = (int (*)(int d, int request, ...)) dlsym (RTLD_NEXT, "ioctl");
     if (d > 0 && d == console_fd)
     {
         struct vt_stat *console_state;
-        int *n;
         int vt;
+        va_list ap;
 
         switch (request)
         {
         case VT_GETSTATE:
-            console_state = data;
+            va_start (ap, request);
+            console_state = va_arg (ap, struct vt_stat *);
+            va_end (ap);
             console_state->v_active = active_vt;
             break;
         case VT_ACTIVATE:
-            vt = GPOINTER_TO_INT (data);
+            va_start (ap, request);
+            vt = va_arg (ap, int);
+            va_end (ap);
             if (vt != active_vt)
             {
                 active_vt = vt;
@@ -465,7 +473,15 @@ ioctl (int d, int request, void *data)
         return 0;
     }
     else
+    {
+        va_list ap;
+        void *data;
+
+        va_start (ap, request);
+        data = va_arg (ap, void *);
+        va_end (ap);
         return _ioctl (d, request, data);
+    }
 }
 
 int
@@ -495,7 +511,7 @@ free_user (gpointer data)
 }
 
 static void
-load_passwd_file ()
+load_passwd_file (void)
 {
     gchar *path, *data = NULL, **lines;
     gint i;
@@ -627,7 +643,7 @@ free_group (gpointer data)
 }
 
 static void
-load_group_file ()
+load_group_file (void)
 {
     gchar *path, *data = NULL, **lines;
     gint i;
@@ -1373,10 +1389,10 @@ setutxent (void)
 {
 }
   
-struct utmp *
-pututxline (struct utmp *ut)
+struct utmpx *
+pututxline (const struct utmpx *ut)
 {
-    return ut;
+    return (struct utmpx *)ut;
 }
 
 void