pseudo_cppcheck.c 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. int main(int argc, char* argv[])
  5. {
  6. int i;
  7. for (i = 1; i < argc; ++i) {
  8. if (strcmp(argv[i], "-bad") == 0)
  9. if (strcmp(argv[i], "-bad") == 0) {
  10. fprintf(stdout, "stdout from bad command line arg '-bad'\n");
  11. fprintf(stderr, "stderr from bad command line arg '-bad'\n");
  12. return 1;
  13. }
  14. }
  15. fprintf(stderr,
  16. "[/foo/bar.c:2]: (error) Array 'abc[10]' accessed at index 12,"
  17. " which is out of bounds.\n");
  18. fprintf(stderr, "[/foo/bar.c:2]: (warning) Member variable 'foo::bar' is "
  19. "not initialized in the constructor.\n");
  20. fprintf(stderr, "[/foo/bar.c:2]: (style) C-style pointer casting.\n");
  21. fprintf(stderr, "[/foo/bar.c:2]: (performance) Variable 'm_message' is "
  22. "assigned in constructor body. Consider performing "
  23. "initialization in initialization list.\n");
  24. fprintf(stderr, "[/foo/bar.c:2]: (portability) scanf without field width "
  25. "limits can crash with huge input data on some versions of "
  26. "libc\n");
  27. fprintf(stderr, "[/foo/bar.c:2]: (information) cannot find all the include "
  28. "files (use --check-config for details)\n");
  29. // we allow this to return 1 as we ignore it
  30. return 1;
  31. }