Debian Codegraph @

rpython/rlib/compilerinfo.py

raw symbols SCIP
1 from rpython.rlib.objectmodel import we_are_translated
2 from rpython.rtyper.lltypesystem import rffi
3 from rpython.translator.platform import platform
4
5
6 def get_compiler_info():
7 """Returns a string like 'MSC v.# 32 bit' or 'GCC #.#.#'.
8 Before translation, returns '(untranslated)'.
9
10 Must be called at run-time, not before translation, otherwise
11 you're freezing the string '(untranslated)' into the executable!
12 """
13 if we_are_translated():
14 return rffi.charp2str(COMPILER_INFO)
15 return "(untranslated)"
16
17 # ____________________________________________________________
18
19
20 if platform.name == 'msvc':
21 if platform.x64:
22 # XXX hard-code the CPU name
23 _C_COMPILER_INFO = '"MSC v." Py_STR(_MSC_VER) " 64 bit (AMD64)"'
24 else:
25 _C_COMPILER_INFO = '"MSC v." Py_STR(_MSC_VER) " 32 bit"'
26 else:
27 _C_COMPILER_INFO = '("GCC " __VERSION__)'
28
29 COMPILER_INFO = rffi.CConstant(_C_COMPILER_INFO, rffi.CCHARP)