make gcc shut up

If -flto is used then gcc will generate a lot more warnings than before,
among them a number of use-without-initialization warnings. Most of them
without are false positives, but let's make them go away, because it
doesn't really matter.
This commit is contained in:
Lennart Poettering 2014-02-19 17:47:11 +01:00
parent ca721e3608
commit 39883f622f
30 changed files with 39 additions and 39 deletions

View file

@ -64,7 +64,7 @@ static struct udev_device *find_pci_or_platform_parent(struct udev_device *devic
value = udev_device_get_sysattr_value(parent, "class"); value = udev_device_get_sysattr_value(parent, "class");
if (value) { if (value) {
unsigned long class; unsigned long class = 0;
if (safe_atolu(value, &class) < 0) { if (safe_atolu(value, &class) < 0) {
log_warning("Cannot parse PCI class %s of device %s:%s.", value, subsystem, sysname); log_warning("Cannot parse PCI class %s of device %s:%s.", value, subsystem, sysname);

View file

@ -50,7 +50,7 @@ static char *tilt_slashes(char *s) {
} }
static int get_boot_entries(struct boot_info *info) { static int get_boot_entries(struct boot_info *info) {
uint16_t *list; uint16_t *list = NULL;
int i, n; int i, n;
int err = 0; int err = 0;

View file

@ -98,7 +98,7 @@ static void group_hashmap_free(Hashmap *h) {
static int process(const char *controller, const char *path, Hashmap *a, Hashmap *b, unsigned iteration) { static int process(const char *controller, const char *path, Hashmap *a, Hashmap *b, unsigned iteration) {
Group *g; Group *g;
int r; int r;
FILE *f; FILE *f = NULL;
pid_t pid; pid_t pid;
unsigned n; unsigned n;

View file

@ -873,7 +873,7 @@ static int method_create_snapshot(sd_bus *bus, sd_bus_message *message, void *us
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
int cleanup; int cleanup;
Snapshot *s; Snapshot *s = NULL;
int r; int r;
assert(bus); assert(bus);

View file

@ -69,7 +69,7 @@ typedef struct StatusInfo {
} StatusInfo; } StatusInfo;
static void print_status_info(StatusInfo *i) { static void print_status_info(StatusInfo *i) {
sd_id128_t mid, bid; sd_id128_t mid = {}, bid = {};
int r; int r;
const char *id = NULL; const char *id = NULL;
_cleanup_free_ char *pretty_name = NULL, *cpe_name = NULL; _cleanup_free_ char *pretty_name = NULL, *cpe_name = NULL;

View file

@ -744,7 +744,7 @@ static int request_handler_file(
static int get_virtualization(char **v) { static int get_virtualization(char **v) {
_cleanup_bus_unref_ sd_bus *bus = NULL; _cleanup_bus_unref_ sd_bus *bus = NULL;
char *b; char *b = NULL;
int r; int r;
r = sd_bus_default_system(&bus); r = sd_bus_default_system(&bus);
@ -780,7 +780,7 @@ static int request_handler_machine(
RequestMeta *m = connection_cls; RequestMeta *m = connection_cls;
int r; int r;
_cleanup_free_ char* hostname = NULL, *os_name = NULL; _cleanup_free_ char* hostname = NULL, *os_name = NULL;
uint64_t cutoff_from, cutoff_to, usage; uint64_t cutoff_from = 0, cutoff_to = 0, usage;
char *json; char *json;
sd_id128_t mid, bid; sd_id128_t mid, bid;
_cleanup_free_ char *v = NULL; _cleanup_free_ char *v = NULL;

View file

@ -1651,7 +1651,7 @@ int main(int argc, char *argv[]) {
} }
if (arg_action == ACTION_DISK_USAGE) { if (arg_action == ACTION_DISK_USAGE) {
uint64_t bytes; uint64_t bytes = 0;
char sbytes[FORMAT_BYTES_MAX]; char sbytes[FORMAT_BYTES_MAX];
r = sd_journal_get_usage(j, &bytes); r = sd_journal_get_usage(j, &bytes);

View file

@ -1281,7 +1281,7 @@ static bool file_type_wanted(int flags, const char *filename) {
} }
static int add_any_file(sd_journal *j, const char *path) { static int add_any_file(sd_journal *j, const char *path) {
JournalFile *f; JournalFile *f = NULL;
int r; int r;
assert(j); assert(j);

View file

@ -687,8 +687,8 @@ static int bus_get_owner_dbus1(
} }
if (mask & SD_BUS_CREDS_SELINUX_CONTEXT) { if (mask & SD_BUS_CREDS_SELINUX_CONTEXT) {
const void *p; const void *p = NULL;
size_t sz; size_t sz = 0;
r = sd_bus_call_method( r = sd_bus_call_method(
bus, bus,

View file

@ -1863,7 +1863,7 @@ _public_ int sd_bus_message_open_container(
struct bus_container *c, *w; struct bus_container *c, *w;
uint32_t *array_size = NULL; uint32_t *array_size = NULL;
char *signature; char *signature;
size_t before, begin; size_t before, begin = 0;
bool need_offsets = false; bool need_offsets = false;
int r; int r;

View file

@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
char *s, *name; char *s, *name;
uint64_t sz; uint64_t sz;
int r, fd; int r, fd;
FILE *f; FILE *f = NULL;
char buf[3] = {}; char buf[3] = {};
struct iovec iov[3] = {}; struct iovec iov[3] = {};
char bufv[3][3] = {}; char bufv[3][3] = {};

View file

@ -642,9 +642,9 @@ static int event_setup_timer_fd(
int *timer_fd, int *timer_fd,
clockid_t id) { clockid_t id) {
sd_id128_t bootid = {};
struct epoll_event ev = {}; struct epoll_event ev = {};
int r, fd; int r, fd;
sd_id128_t bootid;
assert(e); assert(e);
assert(timer_fd); assert(timer_fd);
@ -2126,7 +2126,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) {
_public_ int sd_event_default(sd_event **ret) { _public_ int sd_event_default(sd_event **ret) {
static thread_local sd_event *default_event = NULL; static thread_local sd_event *default_event = NULL;
sd_event *e; sd_event *e = NULL;
int r; int r;
if (!ret) if (!ret)

View file

@ -76,7 +76,7 @@ static int child_handler(sd_event_source *s, const siginfo_t *si, void *userdata
} }
static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
sd_event_source *p; sd_event_source *p = NULL;
sigset_t ss; sigset_t ss;
pid_t pid; pid_t pid;
@ -106,7 +106,7 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si,
} }
static int defer_handler(sd_event_source *s, void *userdata) { static int defer_handler(sd_event_source *s, void *userdata) {
sd_event_source *p; sd_event_source *p = NULL;
sigset_t ss; sigset_t ss;
assert(s); assert(s);

View file

@ -480,7 +480,7 @@ static int session_start_scope(Session *s) {
if (!s->scope) { if (!s->scope) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_free_ char *description = NULL; _cleanup_free_ char *description = NULL;
char *scope, *job; char *scope, *job = NULL;
description = strjoin("Session ", s->id, " of user ", s->user->name, NULL); description = strjoin("Session ", s->id, " of user ", s->user->name, NULL);
if (!description) if (!description)
@ -567,7 +567,7 @@ int session_start(Session *s) {
static int session_stop_scope(Session *s, bool force) { static int session_stop_scope(Session *s, bool force) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
char *job; char *job = NULL;
int r; int r;
assert(s); assert(s);

View file

@ -39,7 +39,7 @@ static void test_login(void) {
uid_t *uids; uid_t *uids;
unsigned n; unsigned n;
struct pollfd pollfd; struct pollfd pollfd;
sd_login_monitor *m; sd_login_monitor *m = NULL;
assert_se(sd_pid_get_session(0, &session) == 0); assert_se(sd_pid_get_session(0, &session) == 0);
printf("session = %s\n", session); printf("session = %s\n", session);

View file

@ -252,7 +252,7 @@ static int machine_start_scope(Machine *m, sd_bus_message *properties, sd_bus_er
if (!m->unit) { if (!m->unit) {
_cleanup_free_ char *escaped = NULL; _cleanup_free_ char *escaped = NULL;
char *scope, *description, *job; char *scope, *description, *job = NULL;
escaped = unit_name_escape(m->name); escaped = unit_name_escape(m->name);
if (!escaped) if (!escaped)
@ -322,7 +322,7 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) {
static int machine_stop_scope(Machine *m) { static int machine_stop_scope(Machine *m) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
char *job; char *job = NULL;
int r; int r;
assert(m); assert(m);

View file

@ -105,7 +105,7 @@ int link_get(Manager *m, int ifindex, Link **ret) {
} }
int link_add(Manager *m, struct udev_device *device, Link **ret) { int link_add(Manager *m, struct udev_device *device, Link **ret) {
Link *link; Link *link = NULL;
Network *network; Network *network;
int r; int r;

View file

@ -743,7 +743,7 @@ static int setup_resolv_conf(const char *dest) {
static int setup_boot_id(const char *dest) { static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL; _cleanup_free_ char *from = NULL, *to = NULL;
sd_id128_t rnd; sd_id128_t rnd = {};
char as_uuid[37]; char as_uuid[37];
int r; int r;

View file

@ -83,7 +83,7 @@ struct acpi_fpdt_boot {
int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) { int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
_cleanup_free_ char *buf = NULL; _cleanup_free_ char *buf = NULL;
struct acpi_table_header *tbl; struct acpi_table_header *tbl;
size_t l; size_t l = 0;
struct acpi_fpdt_header *rec; struct acpi_fpdt_header *rec;
int r; int r;
uint64_t ptr = 0; uint64_t ptr = 0;

View file

@ -26,7 +26,7 @@
#include "efivars.h" #include "efivars.h"
int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) { int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
usec_t x, y, a; usec_t x = 0, y = 0, a;
int r; int r;
dual_timestamp _n; dual_timestamp _n;

View file

@ -130,7 +130,7 @@ int efi_get_variable(
int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p) { int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p) {
_cleanup_free_ void *s = NULL; _cleanup_free_ void *s = NULL;
size_t ss; size_t ss = 0;
int r; int r;
char *x; char *x;
@ -393,7 +393,7 @@ fail:
static int read_usec(sd_id128_t vendor, const char *name, usec_t *u) { static int read_usec(sd_id128_t vendor, const char *name, usec_t *u) {
_cleanup_free_ char *j = NULL; _cleanup_free_ char *j = NULL;
int r; int r;
uint64_t x; uint64_t x = 0;
assert(name); assert(name);
assert(u); assert(u);

View file

@ -220,8 +220,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
static bool enough_memory_for_hibernation(void) { static bool enough_memory_for_hibernation(void) {
_cleanup_free_ char *active = NULL; _cleanup_free_ char *active = NULL;
unsigned long long act; unsigned long long act = 0;
size_t size, used; size_t size = 0, used = 0;
int r; int r;
r = hibernation_partition_size(&size, &used); r = hibernation_partition_size(&size, &used);

View file

@ -585,7 +585,7 @@ int getpeername_pretty(int fd, char **ret) {
return -errno; return -errno;
if (sa.sa.sa_family == AF_UNIX) { if (sa.sa.sa_family == AF_UNIX) {
struct ucred ucred; struct ucred ucred = {};
/* UNIX connection sockets are anonymous, so let's use /* UNIX connection sockets are anonymous, so let's use
* PID/UID as pretty credentials instead */ * PID/UID as pretty credentials instead */

View file

@ -5903,7 +5903,7 @@ int proc_cmdline(char **ret) {
int r; int r;
if (detect_container(NULL) > 0) { if (detect_container(NULL) > 0) {
char *buf, *p; char *buf = NULL, *p;
size_t sz = 0; size_t sz = 0;
r = read_full_file("/proc/1/cmdline", &buf, &sz); r = read_full_file("/proc/1/cmdline", &buf, &sz);

View file

@ -32,7 +32,7 @@
#include "test-helper.h" #include "test-helper.h"
static int test_cgroup_mask(void) { static int test_cgroup_mask(void) {
Manager *m; Manager *m = NULL;
Unit *son, *daughter, *parent, *root, *grandchild, *parent_deep; Unit *son, *daughter, *parent, *root, *grandchild, *parent_deep;
FILE *serial = NULL; FILE *serial = NULL;
FDSet *fdset = NULL; FDSet *fdset = NULL;

View file

@ -25,7 +25,7 @@
#include "macro.h" #include "macro.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
Manager *m; Manager *m = NULL;
Unit *idle_ok, *idle_bad, *rr_ok, *rr_bad, *rr_sched; Unit *idle_ok, *idle_bad, *rr_ok, *rr_bad, *rr_sched;
Service *ser; Service *ser;
FILE *serial = NULL; FILE *serial = NULL;

View file

@ -110,7 +110,7 @@ static void test_replacements(void) {
} }
static int test_unit_printf(void) { static int test_unit_printf(void) {
Manager *m; Manager *m = NULL;
Unit *u, *u2; Unit *u, *u2;
int r; int r;

View file

@ -567,11 +567,11 @@ static void test_in_set(void) {
static void test_writing_tmpfile(void) { static void test_writing_tmpfile(void) {
char name[] = "/tmp/test-systemd_writing_tmpfile.XXXXXX"; char name[] = "/tmp/test-systemd_writing_tmpfile.XXXXXX";
_cleanup_free_ char *contents; _cleanup_free_ char *contents = NULL;
size_t size; size_t size;
int fd, r; int fd, r;
struct iovec iov[3]; struct iovec iov[3];
IOVEC_SET_STRING(iov[0], "abc\n"); IOVEC_SET_STRING(iov[0], "abc\n");
IOVEC_SET_STRING(iov[1], ALPHANUMERICAL "\n"); IOVEC_SET_STRING(iov[1], ALPHANUMERICAL "\n");
IOVEC_SET_STRING(iov[2], ""); IOVEC_SET_STRING(iov[2], "");

View file

@ -361,7 +361,7 @@ static int parse_password(const char *filename, char **wall) {
} else { } else {
int tty_fd = -1; int tty_fd = -1;
char *password; char *password = NULL;
if (arg_console) if (arg_console)
if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) { if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) {

View file

@ -180,7 +180,7 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl)
struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
{ {
struct udev_ctrl_connection *conn; struct udev_ctrl_connection *conn;
struct ucred ucred; struct ucred ucred = {};
const int on = 1; const int on = 1;
int r; int r;