/* Define GUESTFS_WARN_DEPRECATED=1 to warn about deprecated API functions. */
#define GUESTFS_DEPRECATED_BY(s)
#if GUESTFS_WARN_DEPRECATED
-# if defined(__GNUC__) && GUESTFS_GCC_VERSION >= 30100 /* gcc >= 3.1.0 */
+# if defined(__GNUC__) && GUESTFS_GCC_VERSION >= 40500 /* gcc >= 4.5 */
# undef GUESTFS_DEPRECATED_BY
# define GUESTFS_DEPRECATED_BY(s) __attribute__((__deprecated__(\"change the program to use guestfs_\" s \" instead of this deprecated function\")))
# endif
if deprecated = None && not test0 && not debug then
pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
+ if optargs <> [] then (
+ iteri (
+ fun i argt ->
+ let uc_shortname = String.uppercase shortname in
+ let n = name_of_argt argt in
+ let uc_n = String.uppercase n in
+ pr "#define GUESTFS_%s_%s %d\n" uc_shortname uc_n i;
+ ) optargs;
+ );
+
generate_prototype ~single_line:true ~semicolon:false
~handle:"g" ~prefix:"guestfs_" shortname style;
(match deprecated with
~prefix:"guestfs_" ~suffix:"_va" ~optarg_proto:VA
shortname style;
+ pr "\n";
pr "struct guestfs_%s_argv {\n" shortname;
pr " uint64_t bitmask;\n";
iteri (
let uc_shortname = String.uppercase shortname in
let n = name_of_argt argt in
let uc_n = String.uppercase n in
- pr "#define GUESTFS_%s_%s %d\n" uc_shortname uc_n i;
- pr "#define GUESTFS_%s_%s_BITMASK (UINT64_C(1)<<%d)\n" uc_shortname uc_n i;
- pr "/* The field below is only valid in this struct if the\n";
- pr " * GUESTFS_%s_%s_BITMASK bit is set\n" uc_shortname uc_n;
- pr " * in the bitmask above, otherwise the contents are ignored.\n";
- pr " */\n";
+ pr "\n";
+ pr "# define GUESTFS_%s_%s_BITMASK (UINT64_C(1)<<%d)\n" uc_shortname uc_n i;
+ pr " /* The field below is only valid in this struct if the\n";
+ pr " * GUESTFS_%s_%s_BITMASK bit is set\n" uc_shortname uc_n;
+ pr " * in the bitmask above. If not, the field is ignored.\n";
+ pr " */\n";
pr " %s%s;\n" c_type n
) optargs;
pr "};\n";
+ pr "\n";
generate_prototype ~single_line:true ~newline:true ~handle:"g"
~prefix:"guestfs_" ~suffix:"_argv" ~optarg_proto:Argv
| RBufferOut _ ->
pr "%s guestfs___print_BufferOut (trace_fp, %s, *size_r);\n" indent rv
| RStringList _ | RHashtable _ ->
- pr "%s fputs (\"[\\\"\", trace_fp);\n" indent;
+ pr "%s fputs (\"[\", trace_fp);\n" indent;
pr "%s for (i = 0; %s[i]; ++i) {\n" indent rv;
- pr "%s if (i > 0) fputs (\"\\\", \\\"\", trace_fp);\n" indent;
+ pr "%s if (i > 0) fputs (\", \", trace_fp);\n" indent;
+ pr "%s fputs (\"\\\"\", trace_fp);\n" indent;
pr "%s fputs (%s[i], trace_fp);\n" indent rv;
+ pr "%s fputs (\"\\\"\", trace_fp);\n" indent;
pr "%s }\n" indent;
- pr "%s fputs (\"\\\"]\", trace_fp);\n" indent;
+ pr "%s fputs (\"]\", trace_fp);\n" indent;
| RStruct (_, typ) ->
(* XXX There is code generated for guestfish for printing
* these structures. We need to make it generally available