MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / CheckNextIncludeOrder

Method CheckNextIncludeOrder

util/cpplint.py:797–848  ·  view source on GitHub ↗

Returns a non-empty error message if the next header is out of order. This function also updates the internal state to be ready to check the next include. Args: header_type: One of the _XXX_HEADER constants defined above. Returns: The empty string if the header is in t

(self, header_type)

Source from the content-addressed store, hash-verified

795 return True
796
797 def CheckNextIncludeOrder(self, header_type):
798 """Returns a non-empty error message if the next header is out of order.
799
800 This function also updates the internal state to be ready to check
801 the next include.
802
803 Args:
804 header_type: One of the _XXX_HEADER constants defined above.
805
806 Returns:
807 The empty string if the header is in the right order, or an
808 error message describing what's wrong.
809
810 """
811 error_message = ('Found %s after %s' %
812 (self._TYPE_NAMES[header_type],
813 self._SECTION_NAMES[self._section]))
814
815 last_section = self._section
816
817 if header_type == _C_SYS_HEADER:
818 if self._section <= self._C_SECTION:
819 self._section = self._C_SECTION
820 else:
821 self._last_header = ''
822 return error_message
823 elif header_type == _CPP_SYS_HEADER:
824 if self._section <= self._CPP_SECTION:
825 self._section = self._CPP_SECTION
826 else:
827 self._last_header = ''
828 return error_message
829 elif header_type == _LIKELY_MY_HEADER:
830 if self._section <= self._MY_H_SECTION:
831 self._section = self._MY_H_SECTION
832 else:
833 self._section = self._OTHER_H_SECTION
834 elif header_type == _POSSIBLE_MY_HEADER:
835 if self._section <= self._MY_H_SECTION:
836 self._section = self._MY_H_SECTION
837 else:
838 # This will always be the fallback because we're not sure
839 # enough that the header is associated with this file.
840 self._section = self._OTHER_H_SECTION
841 else:
842 assert header_type == _OTHER_HEADER
843 self._section = self._OTHER_H_SECTION
844
845 if last_section != self._section:
846 self._last_header = ''
847
848 return ''
849
850
851class _CppLintState(object):

Callers 1

CheckIncludeLineFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected