| 97 | #define check(...) check_(__FILE__, __LINE__, __VA_ARGS__) |
| 98 | template<size_t size> |
| 99 | void check_(const char* file, int line, const char (&code)[size], const CheckOptions& options = make_default_obj()) { |
| 100 | // TODO: using dedicated Settings (i.e. copying it) object causes major slowdown |
| 101 | settings1.severity.setEnabled(Severity::portability, options.portability); |
| 102 | settings1.certainty.setEnabled(Certainty::inconclusive, options.inconclusive); |
| 103 | PLATFORM(settings1.platform, options.platform); |
| 104 | settings1.platform.defaultSign = options.defaultSign; |
| 105 | |
| 106 | // Tokenize.. |
| 107 | SimpleTokenizer tokenizer(settings1, *this, options.cpp); |
| 108 | ASSERT_LOC(tokenizer.tokenize(code), file, line); |
| 109 | |
| 110 | // Check.. |
| 111 | if (options.onlyFormatStr) { |
| 112 | CheckIOImpl checkIO(&tokenizer, settings1, *this); |
| 113 | checkIO.checkWrongPrintfScanfArguments(); |
| 114 | return; |
| 115 | } |
| 116 | CheckIO check; |
| 117 | runChecks(check, tokenizer, *this); |
| 118 | } |
| 119 | |
| 120 | void coutCerrMisusage() { |
| 121 | check( |
nothing calls this directly
no test coverage detected