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");
if (value) {
unsigned long class;
unsigned long class = 0;
if (safe_atolu(value, &class) < 0) {
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) {
uint16_t *list;
uint16_t *list = NULL;
int i, n;
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) {
Group *g;
int r;
FILE *f;
FILE *f = NULL;
pid_t pid;
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;
const char *name;
int cleanup;
Snapshot *s;
Snapshot *s = NULL;
int r;
assert(bus);

View File

@ -69,7 +69,7 @@ typedef struct StatusInfo {
} StatusInfo;
static void print_status_info(StatusInfo *i) {
sd_id128_t mid, bid;
sd_id128_t mid = {}, bid = {};
int r;
const char *id = 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) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
char *b;
char *b = NULL;
int r;
r = sd_bus_default_system(&bus);
@ -780,7 +780,7 @@ static int request_handler_machine(
RequestMeta *m = connection_cls;
int r;
_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;
sd_id128_t mid, bid;
_cleanup_free_ char *v = NULL;

View File

@ -1651,7 +1651,7 @@ int main(int argc, char *argv[]) {
}
if (arg_action == ACTION_DISK_USAGE) {
uint64_t bytes;
uint64_t bytes = 0;
char sbytes[FORMAT_BYTES_MAX];
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) {
JournalFile *f;
JournalFile *f = NULL;
int r;
assert(j);

View File

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

View File

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

View File

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

View File

@ -642,9 +642,9 @@ static int event_setup_timer_fd(
int *timer_fd,
clockid_t id) {
sd_id128_t bootid = {};
struct epoll_event ev = {};
int r, fd;
sd_id128_t bootid;
assert(e);
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) {
static thread_local sd_event *default_event = NULL;
sd_event *e;
sd_event *e = NULL;
int r;
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) {
sd_event_source *p;
sd_event_source *p = NULL;
sigset_t ss;
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) {
sd_event_source *p;
sd_event_source *p = NULL;
sigset_t ss;
assert(s);

View File

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

View File

@ -39,7 +39,7 @@ static void test_login(void) {
uid_t *uids;
unsigned n;
struct pollfd pollfd;
sd_login_monitor *m;
sd_login_monitor *m = NULL;
assert_se(sd_pid_get_session(0, &session) == 0);
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) {
_cleanup_free_ char *escaped = NULL;
char *scope, *description, *job;
char *scope, *description, *job = NULL;
escaped = unit_name_escape(m->name);
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) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
char *job;
char *job = NULL;
int r;
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) {
Link *link;
Link *link = NULL;
Network *network;
int r;

View File

@ -743,7 +743,7 @@ static int setup_resolv_conf(const char *dest) {
static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
sd_id128_t rnd;
sd_id128_t rnd = {};
char as_uuid[37];
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) {
_cleanup_free_ char *buf = NULL;
struct acpi_table_header *tbl;
size_t l;
size_t l = 0;
struct acpi_fpdt_header *rec;
int r;
uint64_t ptr = 0;

View File

@ -26,7 +26,7 @@
#include "efivars.h"
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;
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) {
_cleanup_free_ void *s = NULL;
size_t ss;
size_t ss = 0;
int r;
char *x;
@ -393,7 +393,7 @@ fail:
static int read_usec(sd_id128_t vendor, const char *name, usec_t *u) {
_cleanup_free_ char *j = NULL;
int r;
uint64_t x;
uint64_t x = 0;
assert(name);
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) {
_cleanup_free_ char *active = NULL;
unsigned long long act;
size_t size, used;
unsigned long long act = 0;
size_t size = 0, used = 0;
int r;
r = hibernation_partition_size(&size, &used);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -361,7 +361,7 @@ static int parse_password(const char *filename, char **wall) {
} else {
int tty_fd = -1;
char *password;
char *password = NULL;
if (arg_console)
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 *conn;
struct ucred ucred;
struct ucred ucred = {};
const int on = 1;
int r;