lib/sod-hosted.c (sod_makev): Use two statements rather than tricky expression.
[sod] / lib / keyword.h
index 1fa3e56..525b31f 100644 (file)
@@ -115,7 +115,7 @@ extern kw_unkhookfn *kw_unkhook;
 
 /*----- Argument list macros ----------------------------------------------*/
 
-/* These macros is intended to be conveniences rather than a proper
+/* These macros are intended to be conveniences rather than a proper
  * abstraction.  Functions with more complicated interfaces, and their
  * callers, will have to make their own arrangements.
  */
@@ -145,7 +145,7 @@ extern kw_unkhookfn *kw_unkhook;
 #define KWARGS(body) body KW__END
 #define KW__END ((const char *)0)
 
-/*  --- @NO_KWARGS@ --- *
+/* --- @NO_KWARGS@ --- *
  *
  * Arguments:  ---
  *
@@ -158,13 +158,13 @@ extern kw_unkhookfn *kw_unkhook;
   /* Slight hack.  The @KWCALL@ macro sets GCC and similar compilers up to
    * check for a sentinal null pointer at the end of the variable-length
    * argument tail.  Alas, if there are no keywords at all, then the null
-   * terminator ends up in the @kwfirst_@ argument, and the tail is propetly
+   * terminator ends up in the @kwfirst_@ argument, and the tail is properly
    * empty, with the result that the compiler gives an annoying warning.
    * Supplying an extra argument here is obviously harmless, and makes the
    * otherwise useful warning go away in this case where it's not wanted.
    */
 
-/*  --- @K@ --- *
+/* --- @K@ --- *
  *
  * Arguments:  @kw@ = keyword name, as an unquoted token list
  *             @val@ = keyword value, as an expression
@@ -174,7 +174,7 @@ extern kw_unkhookfn *kw_unkhook;
 
 #define K(kw, val) #kw, (val),
 
-/* --- @KW_VALIST@ --- *
+/* --- @K_VALIST@ --- *
  *
  * Arguments:  @va_list ap@ = argument-list extraction state
  *
@@ -184,7 +184,7 @@ extern kw_unkhookfn *kw_unkhook;
 
 #define K_VALIST(ap) "kw.valist", &(ap),
 
-/* --- @KW_TAB@ --- *
+/* --- @K_TAB@ --- *
  *
  * Arguments:  @const struct kwval *v@ = base address of argument vector
  *             @size_t n@ = length of argument vector
@@ -235,7 +235,7 @@ extern kw_unkhookfn *kw_unkhook;
     set##_KWSET(KWSET__SUPPLIEDP)                                      \
     set##_KWSET(KWSET__STRUCTMEM)                                      \
   }
-#define KWSET__SUPPLIEDP(type, name, dflt) unsigned name##_suppliedp : 1;
+#define KWSET__SUPPLIEDP(type, name, dflt) unsigned name##_suppliedp: 1;
 #define KWSET__STRUCTMEM(type, name, dflt) type name;
 
 /* --- @KWSET_PARSEFN@ --- *
@@ -322,7 +322,8 @@ extern kw_unkhookfn *kw_unkhook;
     size_t nn;                                                         \
                                                                        \
     for (k = kwfirst; k; k = va_arg(*ap, const char *)) {              \
-      if (!strcmp(k, "kw.valist")) {                                   \
+      set##_KWSET(KWSET__ARGVA)                                                \
+      /*else*/ if (!strcmp(k, "kw.valist")) {                          \
        aap = va_arg(*ap, va_list *);                                   \
        kk = va_arg(*aap, const char *);                                \
        set##_kwparse(kw, kk, aap, 0, 0);                               \
@@ -330,35 +331,33 @@ extern kw_unkhookfn *kw_unkhook;
        vv = va_arg(*ap, const struct kwval *);                         \
        nn = va_arg(*ap, size_t);                                       \
        set##_kwparse(kw, 0, 0, vv, nn);                                \
-      }                                                                        \
-      set##_KWSET(KWSET__ARGVA)                                                \
-      else kw_unknown(#set, k);                                                \
+      } else kw_unknown(#set, k);                                      \
     }                                                                  \
                                                                        \
     while (n) {                                                                \
-      if (!strcmp(v->kw, "kw.valist")) {                               \
+      set##_KWSET(KWSET__ARGTAB)                                       \
+      /*else*/ if (!strcmp(v->kw, "kw.valist")) {                      \
        aap = *(va_list *const *)v->val;                                \
        kk = va_arg(*aap, const char *);                                \
        set##_kwparse(kw, kk, aap, 0, 0);                               \
       } else if (!strcmp(v->kw, "kw.tab")) {                           \
        t = (const struct kwtab *)v->val;                               \
        set##_kwparse(kw, 0, 0, t->v, t->n);                            \
-      }                                                                        \
-      set##_KWSET(KWSET__ARGTAB)                                       \
-      else kw_unknown(#set, v->kw);                                    \
+      } else kw_unknown(#set, v->kw);                                  \
       v++; n--;                                                                \
     }                                                                  \
   }
+
 #define KWSET__ARGVA(type, name, dflt)                                 \
-  else if (!strcmp(k, #name)) {                                                \
+  if (!strcmp(k, #name)) {                                             \
     kw->name##_suppliedp = 1;                                          \
     kw->name = va_arg(*ap, type);                                      \
-  }
+  } else
 #define KWSET__ARGTAB(type, name, dflt)                                        \
-  else if (!strcmp(v->kw, #name)) {                                    \
+  if (!strcmp(v->kw, #name)) {                                         \
     kw->name##_suppliedp = 1;                                          \
     kw->name = *(type const *)v->val;                                  \
-  }
+  } else
 
 /*----- Defining keyword-accepting functions ------------------------------*/
 
@@ -471,8 +470,8 @@ extern kw_unkhookfn *kw_unkhook;
  * Use:                Copies arguments from the source structure @kw@ into the
  *             vector @v@.  The structure @kw@ must have type @struct
  *             fromset_kwargs *@.  The argument @v@ must have type @struct
- *             kwval *@ (after array-to- pointer decay), and there must be a
- *             variable @v_n@ of sufficiently large integral type suitably
+ *             kwval *@ (after array-to-pointer decay), and there must be a
+ *             variable @n@ of sufficiently large integral type suitably
  *             initialized.  Elements of the vector, starting with element
  *             @n@, will be filled in with those keyword arguments defined
  *             in @toset@ -- which must be a subset of @srcsrc@ from @kw@