CMake/Tests/RunCMake/pseudo_tidy.c
Brad King 80ebc55a7c cmake: Report if the <LANG>_CLANG_TIDY tool exits with non-zero
When using `<LANG>_CLANG_TIDY` our internal launcher for the tool must
capture its return code and stderr and report them on failure.
Otherwise incorrect command lines silently fail.

Closes: #16435
2016-11-18 09:43:22 -05:00

21 lines
496 B
C

#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
int i;
for (i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-bad") == 0) {
fprintf(stdout, "stdout from bad command line arg '-bad'\n");
fprintf(stderr, "stderr from bad command line arg '-bad'\n");
return 1;
}
if (argv[i][0] != '-') {
fprintf(stdout, "%s:0:0: warning: message [checker]\n", argv[i]);
break;
}
}
fprintf(stderr, "1 warning generated.\n");
return 0;
}