mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-22 05:34:12 -04:00
scanner: Add --strict flag
Add a --strict flag for making wayland-scanner fail if the DTD verification fails. This is useful for testing, so that a test case can fail a scan when the protocol doesn't comply with the DTD. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
a46d89de9a
commit
8d4250ab5e
1 changed files with 13 additions and 2 deletions
|
|
@ -72,7 +72,9 @@ usage(int ret)
|
||||||
" the scanner was built against.\n"
|
" the scanner was built against.\n"
|
||||||
" -c, --include-core-only include the core version of the headers,\n"
|
" -c, --include-core-only include the core version of the headers,\n"
|
||||||
" that is e.g. wayland-client-core.h instead\n"
|
" that is e.g. wayland-client-core.h instead\n"
|
||||||
" of wayland-client.h.\n");
|
" of wayland-client.h.\n"
|
||||||
|
" -s, --strict exit immediately with an error if DTD\n"
|
||||||
|
" verification fails.\n");
|
||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1801,6 +1803,7 @@ int main(int argc, char *argv[])
|
||||||
bool help = false;
|
bool help = false;
|
||||||
bool core_headers = false;
|
bool core_headers = false;
|
||||||
bool version = false;
|
bool version = false;
|
||||||
|
bool strict = false;
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
int opt;
|
int opt;
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -1813,11 +1816,12 @@ int main(int argc, char *argv[])
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
{ "include-core-only", no_argument, NULL, 'c' },
|
{ "include-core-only", no_argument, NULL, 'c' },
|
||||||
|
{ "strict", no_argument, NULL, 's' },
|
||||||
{ 0, 0, NULL, 0 }
|
{ 0, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
opt = getopt_long(argc, argv, "hvc", options, NULL);
|
opt = getopt_long(argc, argv, "hvcs", options, NULL);
|
||||||
|
|
||||||
if (opt == -1)
|
if (opt == -1)
|
||||||
break;
|
break;
|
||||||
|
|
@ -1832,6 +1836,9 @@ int main(int argc, char *argv[])
|
||||||
case 'c':
|
case 'c':
|
||||||
core_headers = true;
|
core_headers = true;
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
strict = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fail = true;
|
fail = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1894,6 +1901,10 @@ int main(int argc, char *argv[])
|
||||||
"* WARNING: XML failed validation against built-in DTD *\n"
|
"* WARNING: XML failed validation against built-in DTD *\n"
|
||||||
"* *\n"
|
"* *\n"
|
||||||
"*******************************************************\n");
|
"*******************************************************\n");
|
||||||
|
if (strict) {
|
||||||
|
fclose(input);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create XML parser */
|
/* create XML parser */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue