~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to cmake/codecheck/rules/do_not_include_libintl

  • Committer: Holger Rapp
  • Date: 2014-06-21 15:17:04 UTC
  • mto: This revision was merged to the branch mainline in revision 6997.
  • Revision ID: sirver@gmx.de-20140621151704-bt0v8z8nnnxq8p1x
Split io_fileread from io_filesystem.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python -tt
 
2
 
 
3
 
 
4
def does_include_libintl(lines, fn):
 
5
    if "i18n.h" in fn:
 
6
        return []
 
7
    for lineno, line in enumerate(lines, 1):
 
8
        if "include <libintl.h>" in line:
 
9
            return [ (fn, lineno,
 
10
                "Do not include libintl.h, instead include base/i18n.h which includes it.") ]
 
11
    return []
 
12
 
 
13
evaluate_matches = does_include_libintl
 
14
 
 
15
 
 
16
#################
 
17
# ALLOWED TESTS #
 
18
#################
 
19
allowed = [
 
20
"""#include <memory>
 
21
 
 
22
std::unique_ptr foo;
 
23
""",
 
24
]
 
25
 
 
26
 
 
27
###################
 
28
# FORBIDDEN TESTS #
 
29
###################
 
30
forbidden = [
 
31
"""
 
32
#include <libintl.h>
 
33
""",
 
34
]