third_party/blink/tools/blinkpy/style/checkers/cpp.py
def check_c_style_cast(line_number, line, raw_line, cast_type, pattern, error):
    """Checks for a C-style cast by looking for the pattern.

    This also handles sizeof(type) warnings, due to similarity of content.

    Args:
      line_number: The number of the line to check.
      line: The line of code to check.
      raw_line: The raw line of code to check, with comments.
      cast_type: The string for the C++ cast to recommend.  This is either
                 reinterpret_cast or static_cast, depending.
      pattern: The regular expression used to find C-style casts.
      error: The function to call with any errors found.
    """
    matched = search(pattern, line)
    if not matched:
        return

    # e.g., sizeof(int)
    sizeof_match = match(r'.*sizeof\s*$', line[0:matched.start(1) - 1])
    if sizeof_match:
        error(line_number, 'runtime/sizeof', 1,
              'Using sizeof(type).  Use sizeof(varname) instead if possible')
        return

    remainder = line[matched.end(0):]

    # The close paren is for function pointers as arguments to a function.
    # eg, void foo(void (*bar)(int));
    # The semicolon check is a more basic function check; also possibly a
    # function pointer typedef.
    # eg, void foo(int); or void foo(int) const;
    # The equals check is for function pointer assignment.
    # eg, void *(*foo)(int) = ...
    #
    # Right now, this will only catch cases where there's a single argument, and
    # it's unnamed.  It should probably be expanded to check for multiple
    # arguments with some unnamed.
    function_match = match(r'\s*(\)|=|(const)?\s*(;|\{|throw\(\)))', remainder)
    if function_match:
        return

    # At this point, all that should be left is actual casts.
    error(
        line_number, 'readability/casting', 4,
        'Using C-style cast.  Use %s<%s>(...) instead' % (cast_type,
                                                          matched.group(1)))
Checks for a C-style cast by looking for the pattern.

    This also handles sizeof(type) warnings, due to similarity of content.

    Args:
      line_number: The number of the line to check.
      line: The line of code to check.
      raw_line: The raw line of code to check, with comments.
      cast_type: The string for the C++ cast to recommend.  This is either
                 reinterpret_cast or static_cast, depending.
      pattern: The regular expression used to find C-style casts.
      error: The function to call with any errors found.
    
Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Checks for a C - style cast by looking for the pattern . This also handles sizeof ( type ) warnings due to similarity of content .
def check_c_style_cast(line_number, line, raw_line, cast_type, pattern, error):
    matched = search(pattern, line)
    if not matched:
        return
    sizeof_match = match(r'.*sizeof\s*$', line[0:matched.start(1) - 1])
    if sizeof_match:
        error(line_number, 'runtime/sizeof', 1,
              'Using sizeof(type).  Use sizeof(varname) instead if possible')
        return
    remainder = line[matched.end(0):]
     Right now, this will only catch cases where there's a single argument, and
     it's unnamed.  It should probably be expanded to check for multiple
     arguments with some unnamed.
    function_match = match(r'\s*(\)|=|(const)?\s*(;|\{|throw\(\)))', remainder)
    if function_match:
        return
     At this point, all that should be left is actual casts.
    error(
        line_number, 'readability/casting', 4,
        'Using C-style cast.  Use %s<%s>(...) instead' % (cast_type,
                                                          matched.group(1)))
def check_c_style_cast ( line_number , line , raw_line , cast_type , pattern , error ) : matched = search ( pattern , line ) if not matched : return sizeof_match = match ( r'.*sizeof\s*$' , line [ 0 : matched . start ( 1 ) - 1 ] ) if sizeof_match : error ( line_number , 'runtime/sizeof' , 1 , 'Using sizeof(type).  Use sizeof(varname) instead if possible' ) return remainder = line [ matched . end ( 0 ) : ] function_match = match ( r'\s*(\)|=|(const)?\s*(;|\{|throw\(\)))' , remainder ) if function_match : return error ( line_number , 'readability/casting' , 4 , 'Using C-style cast.  Use %s<%s>(...) instead' % ( cast_type , matched . group ( 1 ) ) )
Checks for a C-style cast by looking for the pattern.
Checks for a C - style cast by looking for the pattern .
"""Checks for a C-style cast by looking for the pattern.

    This also handles sizeof(type) warnings, due to similarity of content.

    Args:
      line_number: The number of the line to check.
      line: The line of code to check.
      raw_line: The raw line of code to check, with comments.
      cast_type: The string for the C++ cast to recommend.  This is either
                 reinterpret_cast or static_cast, depending.
      pattern: The regular expression used to find C-style casts.
      error: The function to call with any errors found.
    """ # e.g., sizeof(int) # The close paren is for function pointers as arguments to a function. # eg, void foo(void (*bar)(int)); # The semicolon check is a more basic function check; also possibly a # function pointer typedef. # eg, void foo(int); or void foo(int) const; # The equals check is for function pointer assignment. # eg, void *(*foo)(int) = ... # # Right now, this will only catch cases where there's a single argument, and # it's unnamed.  It should probably be expanded to check for multiple # arguments with some unnamed. # At this point, all that should be left is actual casts.
line_number
The number of the line to check.
The number of the line to check .
line
The line of code to check.
The line of code to check .
raw_line
The raw line of code to check, with comments.
The raw line of code to check with comments .
cast_type
The string for the C++ cast to recommend.  This is either
reinterpret_cast or static_cast, depending.
The string for the C ++ cast to recommend . This is either reinterpret_cast or static_cast depending .
pattern
The regular expression used to find C-style casts.
The regular expression used to find C - style casts .
error
The function to call with any errors found.
The function to call with any errors found .