| @@ 4246-4266 (lines=21) @@ | ||
| 4243 | ('If statement had no body and no else clause')) |
|
| 4244 | ||
| 4245 | ||
| 4246 | def FindCheckMacro(line): |
|
| 4247 | """Find a replaceable CHECK-like macro. |
|
| 4248 | ||
| 4249 | Args: |
|
| 4250 | line: line to search on. |
|
| 4251 | Returns: |
|
| 4252 | (macro name, start position), or (None, -1) if no replaceable |
|
| 4253 | macro is found. |
|
| 4254 | """ |
|
| 4255 | for macro in _CHECK_MACROS: |
|
| 4256 | i = line.find(macro) |
|
| 4257 | if i >= 0: |
|
| 4258 | # Find opening parenthesis. Do a regular expression match here |
|
| 4259 | # to make sure that we are matching the expected CHECK macro, as |
|
| 4260 | # opposed to some other macro that happens to contain the CHECK |
|
| 4261 | # substring. |
|
| 4262 | matched = Match(r'^(.*\b' + macro + r'\s*)\(', line) |
|
| 4263 | if not matched: |
|
| 4264 | continue |
|
| 4265 | return (macro, len(matched.group(1))) |
|
| 4266 | return (None, -1) |
|
| 4267 | ||
| 4268 | ||
| 4269 | def CheckCheck(filename, clean_lines, linenum, error): |
|
| @@ 4246-4266 (lines=21) @@ | ||
| 4243 | ('If statement had no body and no else clause')) |
|
| 4244 | ||
| 4245 | ||
| 4246 | def FindCheckMacro(line): |
|
| 4247 | """Find a replaceable CHECK-like macro. |
|
| 4248 | ||
| 4249 | Args: |
|
| 4250 | line: line to search on. |
|
| 4251 | Returns: |
|
| 4252 | (macro name, start position), or (None, -1) if no replaceable |
|
| 4253 | macro is found. |
|
| 4254 | """ |
|
| 4255 | for macro in _CHECK_MACROS: |
|
| 4256 | i = line.find(macro) |
|
| 4257 | if i >= 0: |
|
| 4258 | # Find opening parenthesis. Do a regular expression match here |
|
| 4259 | # to make sure that we are matching the expected CHECK macro, as |
|
| 4260 | # opposed to some other macro that happens to contain the CHECK |
|
| 4261 | # substring. |
|
| 4262 | matched = Match(r'^(.*\b' + macro + r'\s*)\(', line) |
|
| 4263 | if not matched: |
|
| 4264 | continue |
|
| 4265 | return (macro, len(matched.group(1))) |
|
| 4266 | return (None, -1) |
|
| 4267 | ||
| 4268 | ||
| 4269 | def CheckCheck(filename, clean_lines, linenum, error): |
|