MCPcopy Create free account
hub / github.com/SIPp/sipp / CheckNextIncludeOrder

Method CheckNextIncludeOrder

cpplint.py:497–548  ·  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

495 return True
496
497 def CheckNextIncludeOrder(self, header_type):
498 """Returns a non-empty error message if the next header is out of order.
499
500 This function also updates the internal state to be ready to check
501 the next include.
502
503 Args:
504 header_type: One of the _XXX_HEADER constants defined above.
505
506 Returns:
507 The empty string if the header is in the right order, or an
508 error message describing what's wrong.
509
510 """
511 error_message = ('Found %s after %s' %
512 (self._TYPE_NAMES[header_type],
513 self._SECTION_NAMES[self._section]))
514
515 last_section = self._section
516
517 if header_type == _C_SYS_HEADER:
518 if self._section <= self._C_SECTION:
519 self._section = self._C_SECTION
520 else:
521 self._last_header = ''
522 return error_message
523 elif header_type == _CPP_SYS_HEADER:
524 if self._section <= self._CPP_SECTION:
525 self._section = self._CPP_SECTION
526 else:
527 self._last_header = ''
528 return error_message
529 elif header_type == _LIKELY_MY_HEADER:
530 if self._section <= self._MY_H_SECTION:
531 self._section = self._MY_H_SECTION
532 else:
533 self._section = self._OTHER_H_SECTION
534 elif header_type == _POSSIBLE_MY_HEADER:
535 if self._section <= self._MY_H_SECTION:
536 self._section = self._MY_H_SECTION
537 else:
538 # This will always be the fallback because we're not sure
539 # enough that the header is associated with this file.
540 self._section = self._OTHER_H_SECTION
541 else:
542 assert header_type == _OTHER_HEADER
543 self._section = self._OTHER_H_SECTION
544
545 if last_section != self._section:
546 self._last_header = ''
547
548 return ''
549
550
551class _CppLintState(object):

Callers 1

CheckIncludeLineFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected