@@ -1900,6 +1900,21 @@ def CheckForBadCharacters(filename, lines, error): |
|
|
1900 |
1900 |
error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.') |
1901 |
1901 |
|
1902 |
1902 |
|
|
1903 |
+def CheckInlineHeader(filename, include_state, error): |
|
1904 |
+"""Logs an error if both a header and its inline variant are included.""" |
|
1905 |
+ |
|
1906 |
+all_headers = dict(item for sublist in include_state.include_list |
|
1907 |
+for item in sublist) |
|
1908 |
+bad_headers = set('%s.h' % name[:-6] for name in all_headers.keys() |
|
1909 |
+if name.endswith('-inl.h')) |
|
1910 |
+bad_headers &= set(all_headers.keys()) |
|
1911 |
+ |
|
1912 |
+for name in bad_headers: |
|
1913 |
+err = '%s includes both %s and %s-inl.h' % (filename, name, name) |
|
1914 |
+linenum = all_headers[name] |
|
1915 |
+error(filename, linenum, 'build/include', 5, err) |
|
1916 |
+ |
|
1917 |
+ |
1903 |
1918 |
def CheckForNewlineAtEOF(filename, lines, error): |
1904 |
1919 |
"""Logs an error if there is no newline char at the end of the file. |
1905 |
1920 |
|
@@ -5866,6 +5881,8 @@ def ProcessFileData(filename, file_extension, lines, error, |
|
|
5866 |
5881 |
|
5867 |
5882 |
CheckForNewlineAtEOF(filename, lines, error) |
5868 |
5883 |
|
|
5884 |
+CheckInlineHeader(filename, include_state, error) |
|
5885 |
+ |
5869 |
5886 |
def ProcessConfigOverrides(filename): |
5870 |
5887 |
""" Loads the configuration files and processes the config overrides. |
5871 |
5888 |
|