summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-08-06 15:34:43 +0100
committerVincent Sanders <vince@kyllikki.org>2015-08-06 15:34:43 +0100
commite78ea8b28064181d9081e7ff0143830c4ec37d7f (patch)
tree0773278a1d5ac3fdd8dcda916a8675a12dba93a8
parentdca5aa6db8f0dbcae283aee21605d8d1a85d7f94 (diff)
downloadnsgenbind-e78ea8b28064181d9081e7ff0143830c4ec37d7f.tar.gz
nsgenbind-e78ea8b28064181d9081e7ff0143830c4ec37d7f.tar.bz2
Enable warnings to be enabled and generated for unimplemented elements
-rw-r--r--src/duk-libdom.c11
-rw-r--r--src/nsgenbind.c18
-rw-r--r--src/options.h2
3 files changed, 28 insertions, 3 deletions
diff --git a/src/duk-libdom.c b/src/duk-libdom.c
index b01ac4e..a2d65af 100644
--- a/src/duk-libdom.c
+++ b/src/duk-libdom.c
@@ -954,6 +954,9 @@ output_interface_operation(FILE* outf,
if (cdatac == 0) {
/* no implementation so generate default */
+ WARN(WARNING_UNIMPLEMENTED,
+ "Unimplemented: method %s::%s();",
+ interfacee->name, operatione->name);
fprintf(outf,"\treturn 0;\n");
}
@@ -1009,6 +1012,10 @@ output_interface_attribute(FILE* outf,
cdatac = output_cdata(outf, atributee->getter, GENBIND_NODE_TYPE_CDATA);
if (cdatac == 0) {
+ WARN(WARNING_UNIMPLEMENTED,
+ "Unimplemented: getter %s::%s();",
+ interfacee->name, atributee->name);
+
/* no implementation so generate default */
fprintf(outf,"\treturn 0;\n");
}
@@ -1031,6 +1038,10 @@ output_interface_attribute(FILE* outf,
cdatac = output_cdata(outf, atributee->setter, GENBIND_NODE_TYPE_CDATA);
if (cdatac == 0) {
+ WARN(WARNING_UNIMPLEMENTED,
+ "Unimplemented: setter %s::%s();",
+ interfacee->name, atributee->name);
+
/* no implementation so generate default */
fprintf(outf,"\treturn 0;\n");
}
diff --git a/src/nsgenbind.c b/src/nsgenbind.c
index 65feedd..173f23d 100644
--- a/src/nsgenbind.c
+++ b/src/nsgenbind.c
@@ -58,7 +58,22 @@ static struct options* process_cmdline(int argc, char **argv)
break;
case 'W':
- options->warnings = 1; /* warning flags */
+ if ((optarg == NULL) ||
+ (strcmp(optarg, "all") == 0)) {
+ /* all warnings */
+ options->warnings |= WARNING_ALL;
+ } else if (strcmp(optarg, "unimplemented") == 0) {
+ options->warnings |= WARNING_UNIMPLEMENTED;
+ } else if (strcmp(optarg, "duplicated") == 0) {
+ options->warnings |= WARNING_DUPLICATED;
+ } else {
+ fprintf(stderr,
+ "Unknown warning option \"%s\" valid options are: all, unimplemented\n",
+ optarg);
+ free(options);
+ return NULL;
+
+ }
break;
default: /* '?' */
@@ -67,7 +82,6 @@ static struct options* process_cmdline(int argc, char **argv)
argv[0]);
free(options);
return NULL;
-
}
}
diff --git a/src/options.h b/src/options.h
index 85f107e..02674b7 100644
--- a/src/options.h
+++ b/src/options.h
@@ -32,7 +32,7 @@ enum opt_warnings {
#define WARN(flags, msg, args...) do { \
if ((options->warnings & flags) != 0) { \
- fprintf(stderr, "%s: warning:"msg"\n", __func__, ## args); \
+ fprintf(stderr, "%s: warning: "msg"\n", __func__, ## args); \
} \
} while(0)