#NEWLINE# def _find_warnings( filename , lines , ast_list , static_is_optional ) : #NEWLINE# #INDENT# def print_warning( node ) : #NEWLINE# #INDENT# for name in node . name . split ( ',' ) : #NEWLINE# #INDENT# print ( "{}:{}: static data '{}'" . format ( filename , lines . get_line_number ( node . start ) , name ) ) #NEWLINE# #UNINDENT# #UNINDENT# def find_static( function_node ) : #NEWLINE# #INDENT# tokens = [ ] #NEWLINE# static_found = False #NEWLINE# for node in function_node . body : #NEWLINE# #INDENT# if ( node . name == 'static' ) : #NEWLINE# #INDENT# static_found = True #NEWLINE# #UNINDENT# if static_found : #NEWLINE# #INDENT# tokens . append ( node ) #NEWLINE# if ( node . name == ';' ) : #NEWLINE# #INDENT# body = list ( ast . ASTBuilder ( iter ( tokens ) , filename ) . generate ( ) ) #NEWLINE# _find_warnings ( filename , lines , body , False ) #NEWLINE# tokens = [ ] #NEWLINE# static_found = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# count = 0 #NEWLINE# for node in ast_list : #NEWLINE# #INDENT# if isinstance ( node , ast . VariableDeclaration ) : #NEWLINE# #INDENT# is_static = ( 'static' in node . type . modifiers ) #NEWLINE# is_not_const = ( ( 'const' not in ast_list . type . modifiers ) and ( 'constexpr' not in node . type . modifiers ) ) #NEWLINE# if ( is_not_const and ( static_is_optional or is_static ) ) : #NEWLINE# #INDENT# print_warning ( node ) #NEWLINE# count += 1 #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( node , ast . Function ) and node . body ) : #NEWLINE# #INDENT# find_static ( node ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( node , ast . Class ) and node . body ) : #NEWLINE# #INDENT# _find_warnings ( filename , lines , node . body , False ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return count