summaryrefslogtreecommitdiff
path: root/ACE/bin/PythonACE/fuzz/cpp_inline.py
blob: 92afe0b1e38f686fd3c66db7fd3c77fa7f26d44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
""" Checks for ACE_INLINE or and ASYS_INLINE in a .cpp file """
from _types import source_files
type_list = source_files


import re
from sys import stderr
regex = re.compile ("(ACE_INLINE)|(ASYS_INLINE)")

error_message = ": error: ACE_INLINE or ASYS_INLINE found in .cpp file\n"

def handler (file_name, file_content):
    if regex.search (file_content) != None:
        # Lets take some time to generate a detailed error report
        # since we appear to have a violation
        lines = file_content.splitlines ()
        for line in range (len (lines)):
            if regex.search (lines[line]) != None:
                stderr.write (file_name + ':' + str (line + 1) + error_message)

        return 1
    else:
        return 0