MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / checkstatic

Function checkstatic

addons/threadsafety.py:292–314  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

290
291
292def checkstatic(data): # noqa: D103
293 for var in data.variables:
294 if var.isStatic and var.isLocal:
295 vartype = None
296 if var.isClass:
297 vartype = 'object'
298 else:
299 vartype = 'variable'
300 if var.isConst:
301 if data.standards.cpp == 'c++03':
302 reportError(
303 var.typeStartToken,
304 'warning',
305 'Local constant static '
306 + vartype + "'" + var.nameToken.str
307 + "', dangerous if it is initialized"
308 + ' in parallel threads',
309 'threadsafety-const')
310 else:
311 reportError(var.typeStartToken, 'warning',
312 'Local static ' + vartype + ': '
313 + var.nameToken.str,
314 'threadsafety')
315
316
317def check_MTunsafe(cfg):

Callers 1

threadsafety.pyFile · 0.85

Calls 1

reportErrorFunction · 0.70

Tested by

no test coverage detected