diff mbox

[2/5] introduce two marcos to dump the options info

Message ID 1390881230-14033-3-git-send-email-akong@redhat.com
State New
Headers show

Commit Message

Amos Kong Jan. 28, 2014, 3:53 a.m. UTC
We will use the marocs to generate two tables, which contain
the option name and argument information.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 qemu-options-wrapper.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Markus Armbruster Feb. 11, 2014, 10:55 a.m. UTC | #1
Amos Kong <akong@redhat.com> writes:

> We will use the marocs to generate two tables, which contain
> the option name and argument information.
>
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  qemu-options-wrapper.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/qemu-options-wrapper.h b/qemu-options-wrapper.h
> index 13bfea0..c36a9ee 100644
> --- a/qemu-options-wrapper.h
> +++ b/qemu-options-wrapper.h
> @@ -18,6 +18,22 @@
>  
>  #define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL)
>  
> +#elif defined(QEMU_OPTIONS_GENERATE_NAME)
> +
> +#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)    \
> +    option,
> +
> +#define DEFHEADING(text)
> +#define ARCHHEADING(text, arch_mask)
> +
> +#elif defined(QEMU_OPTIONS_GENERATE_HASARG)
> +
> +#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)    \
> +    stringify(opt_arg),
> +
> +#define DEFHEADING(text)
> +#define ARCHHEADING(text, arch_mask)
> +
>  #elif defined(QEMU_OPTIONS_GENERATE_OPTIONS)
>  
>  #define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)     \
> @@ -38,4 +54,6 @@
>  
>  #undef QEMU_OPTIONS_GENERATE_ENUM
>  #undef QEMU_OPTIONS_GENERATE_HELP
> +#undef QEMU_OPTIONS_GENERATE_NAME
> +#undef QEMU_OPTIONS_GENERATE_HASPARAM
>  #undef QEMU_OPTIONS_GENERATE_OPTIONS

Personally, I find this indirection through qemu-options-wrapper.h
silly.  The ultimate user could just as well define the necessary DEF
macros itself, instead of telling a wrapper what it wants defined by
defining yet another macro.

Not your fault, and I'm not demanding you change it.
Eric Blake Feb. 12, 2014, 8:37 p.m. UTC | #2
On 01/27/2014 08:53 PM, Amos Kong wrote:

s/marcos/macros/ in the subject line

> We will use the marocs to generate two tables, which contain

s/marocs/macros/

(wow, two different ways to mis-spell the word)

> the option name and argument information.
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  qemu-options-wrapper.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

although I'd probably squash this with the patch that actually defines
QEMU_OPTIONS_GENERATE_{NAME,HASARG}, as this patch is useless on its own.
diff mbox

Patch

diff --git a/qemu-options-wrapper.h b/qemu-options-wrapper.h
index 13bfea0..c36a9ee 100644
--- a/qemu-options-wrapper.h
+++ b/qemu-options-wrapper.h
@@ -18,6 +18,22 @@ 
 
 #define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL)
 
+#elif defined(QEMU_OPTIONS_GENERATE_NAME)
+
+#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)    \
+    option,
+
+#define DEFHEADING(text)
+#define ARCHHEADING(text, arch_mask)
+
+#elif defined(QEMU_OPTIONS_GENERATE_HASARG)
+
+#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)    \
+    stringify(opt_arg),
+
+#define DEFHEADING(text)
+#define ARCHHEADING(text, arch_mask)
+
 #elif defined(QEMU_OPTIONS_GENERATE_OPTIONS)
 
 #define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)     \
@@ -38,4 +54,6 @@ 
 
 #undef QEMU_OPTIONS_GENERATE_ENUM
 #undef QEMU_OPTIONS_GENERATE_HELP
+#undef QEMU_OPTIONS_GENERATE_NAME
+#undef QEMU_OPTIONS_GENERATE_HASPARAM
 #undef QEMU_OPTIONS_GENERATE_OPTIONS