File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,10 +138,26 @@ bool CppCheck::findError(std::string code, const char FileName[])
138138 return true ;
139139}
140140
141+ // Disable debug warnings?
142+ static bool no_debug_warnings (const std::string &filename) {
143+ const std::string::size_type pos = filename.rfind (" ." );
144+ if (pos == std::string::npos)
145+ return false ;
146+ const std::string ext = filename.substr (pos);
147+
148+ // Only allow debug warnings if file extension is c or cpp so people
149+ // won't be tempted to fix java / c# problems spotted this way.
150+ return bool (ext != " .c" && ext != " .cpp" );
151+ }
152+
141153unsigned int CppCheck::processFile ()
142154{
143155 exitcode = 0 ;
144156
157+ // disable debug warnings?
158+ if (no_debug_warnings (_filename))
159+ _settings.debugwarnings = false ;
160+
145161 // TODO: Should this be moved out to its own function so all the files can be
146162 // analysed before any files are checked?
147163 if (_settings.test_2_pass && _settings._jobs == 1 ) {
You can’t perform that action at this time.
0 commit comments