Get rid of uninitialized_var()
authorJens Axboe <axboe@kernel.dk>
Tue, 13 Nov 2012 15:31:24 +0000 (08:31 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 Nov 2012 15:31:24 +0000 (08:31 -0700)
It causes complaints on other compilers (clang). One case
was actually not used at all, initialize the rest to 0.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
compiler/compiler.h
engines/splice.c
io_u.c

index 8dec350b9f9eb4e1c495e5c7aa1174b60169cbd3..8923f9a6235190d0837505c1852363fdf3fd6162 100644 (file)
@@ -13,8 +13,6 @@
 #define __must_check
 #endif
 
 #define __must_check
 #endif
 
-#define uninitialized_var(x) x = x
-
 #ifndef _weak
 #ifndef __CYGWIN__
 #define _weak  __attribute__((weak))
 #ifndef _weak
 #ifndef __CYGWIN__
 #define _weak  __attribute__((weak))
index aa00234e4576f17098e14ea2ace651b6b771a61c..ca7997b70aeae1142263a580acdfb555c6fd8b2c 100644 (file)
@@ -204,7 +204,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
 static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
 {
        struct spliceio_data *sd = td->io_ops->data;
 static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
 {
        struct spliceio_data *sd = td->io_ops->data;
-       int uninitialized_var(ret);
+       int ret = 0;
 
        fio_ro_check(td, io_u);
 
 
        fio_ro_check(td, io_u);
 
diff --git a/io_u.c b/io_u.c
index 119dd651a23ef7cbcdf121b2884eca98f3fcb57e..d81fefdeefe2269e2be9df49d976cc7c0c801c22 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -413,7 +413,7 @@ static inline int io_u_fits(struct thread_data *td, struct io_u *io_u,
 static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u)
 {
        const int ddir = io_u->ddir;
 static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u)
 {
        const int ddir = io_u->ddir;
-       unsigned int uninitialized_var(buflen);
+       unsigned int buflen = 0;
        unsigned int minbs, maxbs;
        unsigned long r, rand_max;
 
        unsigned int minbs, maxbs;
        unsigned long r, rand_max;
 
@@ -1345,7 +1345,7 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
                                  struct io_completion_data *icd,
                                  const enum fio_ddir idx, unsigned int bytes)
 {
                                  struct io_completion_data *icd,
                                  const enum fio_ddir idx, unsigned int bytes)
 {
-       unsigned long uninitialized_var(lusec);
+       unsigned long lusec = 0;
 
        if (!td->o.disable_clat || !td->o.disable_bw)
                lusec = utime_since(&io_u->issue_time, &icd->time);
 
        if (!td->o.disable_clat || !td->o.disable_bw)
                lusec = utime_since(&io_u->issue_time, &icd->time);
@@ -1388,11 +1388,6 @@ static long long usec_for_io(struct thread_data *td, enum fio_ddir ddir)
 static void io_completed(struct thread_data *td, struct io_u *io_u,
                         struct io_completion_data *icd)
 {
 static void io_completed(struct thread_data *td, struct io_u *io_u,
                         struct io_completion_data *icd)
 {
-       /*
-        * Older gcc's are too dumb to realize that usec is always used
-        * initialized, silence that warning.
-        */
-       unsigned long uninitialized_var(usec);
        struct fio_file *f;
 
        dprint_io_u(io_u, "io complete");
        struct fio_file *f;
 
        dprint_io_u(io_u, "io complete");