| @@ 2089-2113 (lines=25) @@ | ||
| 2086 | '#endif line should be "#endif // %s"' % cppvar) |
|
| 2087 | ||
| 2088 | ||
| 2089 | def CheckHeaderFileIncluded(filename, include_state, error): |
|
| 2090 | """Logs an error if a source file does not include its header.""" |
|
| 2091 | ||
| 2092 | # Do not check test files |
|
| 2093 | fileinfo = FileInfo(filename) |
|
| 2094 | if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()): |
|
| 2095 | return |
|
| 2096 | ||
| 2097 | for ext in GetHeaderExtensions(): |
|
| 2098 | basefilename = filename[0:len(filename) - len(fileinfo.Extension())] |
|
| 2099 | headerfile = basefilename + '.' + ext |
|
| 2100 | if not os.path.exists(headerfile): |
|
| 2101 | continue |
|
| 2102 | headername = FileInfo(headerfile).RepositoryName() |
|
| 2103 | first_include = None |
|
| 2104 | for section_list in include_state.include_list: |
|
| 2105 | for f in section_list: |
|
| 2106 | if headername in f[0] or f[0] in headername: |
|
| 2107 | return |
|
| 2108 | if not first_include: |
|
| 2109 | first_include = f[1] |
|
| 2110 | ||
| 2111 | error(filename, first_include, 'build/include', 5, |
|
| 2112 | '%s should include its header file %s' % (fileinfo.RepositoryName(), |
|
| 2113 | headername)) |
|
| 2114 | ||
| 2115 | ||
| 2116 | def CheckForBadCharacters(filename, lines, error): |
|
| @@ 2089-2113 (lines=25) @@ | ||
| 2086 | '#endif line should be "#endif // %s"' % cppvar) |
|
| 2087 | ||
| 2088 | ||
| 2089 | def CheckHeaderFileIncluded(filename, include_state, error): |
|
| 2090 | """Logs an error if a source file does not include its header.""" |
|
| 2091 | ||
| 2092 | # Do not check test files |
|
| 2093 | fileinfo = FileInfo(filename) |
|
| 2094 | if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()): |
|
| 2095 | return |
|
| 2096 | ||
| 2097 | for ext in GetHeaderExtensions(): |
|
| 2098 | basefilename = filename[0:len(filename) - len(fileinfo.Extension())] |
|
| 2099 | headerfile = basefilename + '.' + ext |
|
| 2100 | if not os.path.exists(headerfile): |
|
| 2101 | continue |
|
| 2102 | headername = FileInfo(headerfile).RepositoryName() |
|
| 2103 | first_include = None |
|
| 2104 | for section_list in include_state.include_list: |
|
| 2105 | for f in section_list: |
|
| 2106 | if headername in f[0] or f[0] in headername: |
|
| 2107 | return |
|
| 2108 | if not first_include: |
|
| 2109 | first_include = f[1] |
|
| 2110 | ||
| 2111 | error(filename, first_include, 'build/include', 5, |
|
| 2112 | '%s should include its header file %s' % (fileinfo.RepositoryName(), |
|
| 2113 | headername)) |
|
| 2114 | ||
| 2115 | ||
| 2116 | def CheckForBadCharacters(filename, lines, error): |
|