Make parse.h C++ safe by avoiding "or" keyword
authorDaniel Gollub <daniel.gollub@t-online.de>
Wed, 12 Feb 2014 15:24:57 +0000 (08:24 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 12 Feb 2014 15:24:57 +0000 (08:24 -0700)
Fixes for g++ (4.7.2) following compiler errors when fio.h
gets included (e.g. in an external C++ ioengine):

--8<---
[...]
parse.h:31:6: error: expected unqualified-id before ‘or’ token
[...]
--->8---

Signed-off-by: Daniel Gollub <d.gollub@telekom.de>
Updated by me to apply to recent version, and fix gfio usage
of ->or as well.

Signed-off-by: Jens Axboe <axboe@fb.com>
goptions.c
options.c
parse.c
parse.h

index 21d642771be3ad881b35bd23aec07c2a146f4b8e..5b5c89ead6995b68c5a40f9bdf7893e372d8ee8b 100644 (file)
@@ -1216,7 +1216,7 @@ static void gopt_handle_str_multi_changed(struct gopt_job_view *gjv,
                        break;
                set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m->checks[i]));
                if (set) {
-                       if (vp->or)
+                       if (vp->orval)
                                val |= vp->oval;
                        else
                                val = vp->oval;
index 9f6bc8d5ece36ba9483284307dfbbdbd9c1f859a..4dcefba05511879ad658efce073f699591351e3d 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1914,18 +1914,18 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                          { .ival = "wait_before",
                            .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
                            .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
-                           .or   = 1,
+                           .orval  = 1,
                          },
                          { .ival = "write",
                            .oval = SYNC_FILE_RANGE_WRITE,
                            .help = "SYNC_FILE_RANGE_WRITE",
-                           .or   = 1,
+                           .orval  = 1,
                          },
                          {
                            .ival = "wait_after",
                            .oval = SYNC_FILE_RANGE_WAIT_AFTER,
                            .help = "SYNC_FILE_RANGE_WAIT_AFTER",
-                           .or   = 1,
+                           .orval  = 1,
                          },
                },
                .type   = FIO_OPT_STR_MULTI,
diff --git a/parse.c b/parse.c
index 6121dfcdd7e9efb083ada55173d8cac863549042..e46fc14ef236e8bb59dac9fb448f2d22b92d4e92 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -415,7 +415,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                        if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) {
                                ret = 0;
                                if (o->off1)
-                                       val_store(ilp, vp->oval, o->off1, vp->or, data, o);
+                                       val_store(ilp, vp->oval, o->off1, vp->orval, data, o);
                                continue;
                        }
                }
diff --git a/parse.h b/parse.h
index 8eefff90c1e88d9b77cd2dba73e41e8e3e88b047..5273d23f6907b41db030d0090ea555f87cf0ee61 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -28,7 +28,7 @@ struct value_pair {
        const char *ival;               /* string option */
        unsigned int oval;              /* output value */
        const char *help;               /* help text for sub option */
-       int or;                         /* OR value */
+       int orval;                      /* OR value */
        void *cb;                       /* sub-option callback */
 };