@@ -163,6 +163,9 @@ char *write_state_filename;
int do_dump;
int do_debug;
+/* For verbose messages. */
+int verbosity_level;
+
static outf_p create_file (const char *, const char *);
static const char * get_file_basename (const char *);
@@ -1841,6 +1844,7 @@ static void
close_output_files (void)
{
outf_p of;
+ int nbwrittenfiles = 0;
for (of = output_files; of; of = of->next)
{
@@ -1854,11 +1858,22 @@ close_output_files (void)
fatal ("writing output file %s: %s", of->name, xstrerror (errno));
if (fclose (newfile) != 0)
fatal ("closing output file %s: %s", of->name, xstrerror (errno));
+ nbwrittenfiles++;
+ if (verbosity_level >= 1)
+ printf ("gengtype write #%-3d %s\n", nbwrittenfiles, of->name);
+ }
+ else {
+ /* output file remains unchanged. */
+ if (verbosity_level >= 2)
+ printf ("gengtype keep %s\n", of->name);
}
free(of->buf);
of->buf = NULL;
of->bufused = of->buflength = 0;
- }
+ };
+
+ if (verbosity_level >= 1)
+ printf ("gengtype wrote %d files.\n", nbwrittenfiles);
}
struct flist {
@@ -4215,6 +4230,7 @@ static const struct option gengtype_long
{
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
+ { "verbose", no_argument, NULL, 'v' },
{ "dump", no_argument, NULL, 'd' },
{ "debug", no_argument, NULL, 'D' },
{ "plugin", required_argument, NULL, 'P' },
@@ -4231,6 +4247,7 @@ print_usage (void)
{
printf ("Usage: %s\n", progname);
printf ("\t -h | --help \t# Give this help.\n");
+ printf ("\t -v | --verbose \t# Increase verbosity. Can be given several times.\n");
printf ("\t -D | --debug \t# Lots of debug output to debug gengtype itself.\n");
printf ("\t -V | --version \t# Give version information.\n");
printf ("\t -d | --dump \t# Dump state for debugging.\n");
@@ -4267,6 +4284,9 @@ parse_program_options (int argc, char**a
case 'd': /* --dump */
do_dump = 1;
break;
+ case 'v': /* --verbose */
+ verbosity_level++;
+ break;
case 'D': /* --debug */
do_debug = 1;
break;
@@ -145,6 +145,9 @@ enum {
};
+/* Level for verbose messages, e.g. output file generation... */
+extern int verbosity_level;
+
/* For debugging purposes of gengtype itself! */
extern int do_dump;
extern int do_debug;