log: use __log_buf() if we know buf != NULL
authorJens Axboe <axboe@kernel.dk>
Fri, 7 Sep 2018 18:09:24 +0000 (12:09 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 7 Sep 2018 18:09:24 +0000 (12:09 -0600)
This apparently causes complaints on cygwin:

    CC stat.o
In file included from os/os-windows.h:18:0,
                 from os/os.h:54,
                 from thread_options.h:5,
                 from fio.h:18,
                 from init.c:19:
init.c: In function ‘add_job’:
os/../log.h:24:12: error: the comparison will always evaluate as ‘true’ for the address of ‘out’ will never be NULL [-Werror=address]
  if ((buf) != NULL)    \
            ^
os/../log.h:24:12: note: in definition of macro ‘log_buf’
  if ((buf) != NULL)    \

which is utterly stupid, but hey...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
client.c

index 00fc29a4b15452778b38f4d9a0c3bee6a574e8ba..314d6e33f5b981c03f4fd727979d4e101bee8a7b 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2216,17 +2216,17 @@ static void run_threads(struct sk_out *sk_out)
                struct buf_output out;
 
                buf_output_init(&out);
-               log_buf(&out, "Starting ");
+               __log_buf(&out, "Starting ");
                if (nr_thread)
-                       log_buf(&out, "%d thread%s", nr_thread,
+                       __log_buf(&out, "%d thread%s", nr_thread,
                                                nr_thread > 1 ? "s" : "");
                if (nr_process) {
                        if (nr_thread)
-                               log_buf(&out, " and ");
-                       log_buf(&out, "%d process%s", nr_process,
+                               __log_buf(&out, " and ");
+                       __log_buf(&out, "%d process%s", nr_process,
                                                nr_process > 1 ? "es" : "");
                }
-               log_buf(&out, "\n");
+               __log_buf(&out, "\n");
                log_info_buf(out.buf, out.buflen);
        }
 
index 2d8a2bb151fbc52db553cf5cca5c59871181cac7..0f28cf6373535959f933c0ab8eddb8c495f256bc 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1151,8 +1151,8 @@ static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd)
        name = client->name ? client->name : client->hostname;
 
        if (!client->skip_newline && !(output_format & FIO_OUTPUT_TERSE))
-               log_buf(&out, "<%s> ", name);
-       log_buf(&out, "%s", buf);
+               __log_buf(&out, "<%s> ", name);
+       __log_buf(&out, "%s", buf);
        log_info_buf(out.buf, out.buflen);
        client->skip_newline = strchr(buf, '\n') == NULL;
 }