3
3
"""
4
4
Utilities for "faking" a compiler response.
5
5
"""
6
+ from __future__ import print_function
6
7
7
8
import inspect
8
9
import os
@@ -24,34 +25,34 @@ def print_llvm_target(self, args):
24
25
raise NotImplementedError
25
26
26
27
def print_as_version (self ):
27
- print >> sys . stderr , """(assembler version goes here)"""
28
+ print ( """(assembler version goes here)""" , file = sys . stderr )
28
29
29
30
def print_ld_version (self ):
30
- print >> sys . stderr , """(linker version goes here)"""
31
+ print ( """(linker version goes here)""" , file = sys . stderr )
31
32
32
33
33
34
class ICCv12_1_3 (FakeCompiler ):
34
35
compiler_name = "icc-12.1.3"
35
36
36
37
def print_verbose_info (self ):
37
- print >> sys . stderr , """\
38
+ print ( """\
38
39
icc: command line warning #10006: ignoring unknown option '-###'
39
40
icc version 12.1.3 (gcc version 4.2.1 compatibility)
40
41
/usr/bin/icc-2011-base/bin/intel64/mcpcom -_g -mP3OPT_inline_alloca -D__HONOR_STD -D__ICC=1210 -D__INTEL_COMPILER=1210 "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__BLOCKS__ -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__NO_INLINE__ -D__GNUC_GNU_INLINE__ -D__GNUC__=4 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__APPLE_CC__=5658 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1073 -D__LITTLE_ENDIAN__ -D__DYNAMIC__ "-D__private_extern__=__attribute__((visibility("hidden")))" -D__LP64__ -D_LP64 -D__GXX_ABI_VERSION=1002 -D__USER_LABEL_PREFIX__=_ -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__x86_64 -D__x86_64__ -D_MT -D__INTEL_COMPILER_BUILD_DATE=20120130 -D__PIC__ -D__APPLE__ -D__MACH__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE__ -D__MMX__ -_k -_8 -_l -_D -_a -_b -E --gnu_version=421 -_W5 --gcc-extern-inline --multibyte_chars --blocks --array_section --simd --simd_func -mP1OPT_print_version=FALSE -mP1OPT_version=12.1-intel64 -mGLOB_diag_use_message_catalog=FALSE /dev/null
41
42
... more boring stuff here ...
42
- """ # noqa
43
+ """ , file = sys . stderr ) # noqa
43
44
44
45
def print_llvm_target (self , args ):
45
- print """\
46
+ print ( """\
46
47
icc: command line warning #10006: ignoring unknown option '-flto'
47
48
.file "null"
48
49
.section __DATA, __data
49
50
# End
50
51
.subsections_via_symbols
51
- """ # noqa
52
+ """ ) # noqa
52
53
53
54
def print_dumpmachine (self ):
54
- print """i686-apple-darwin11"""
55
+ print ( """i686-apple-darwin11""" )
55
56
56
57
57
58
class LLVMCompiler (FakeCompiler ):
@@ -60,95 +61,95 @@ def print_llvm_target(self, args):
60
61
for arg in args :
61
62
if arg .startswith ("--target=" ):
62
63
target = arg [len ("--target=" ):]
63
- print """\
64
+ print ( """\
64
65
; ModuleID = '/dev/null'
65
66
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
66
67
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-\
67
68
n8:16:32:64"
68
69
target triple = "%s"
69
- """ % target
70
+ """ % target )
70
71
71
72
def print_dumpmachine (self ):
72
- print """x86_64-apple-darwin11.0.0"""
73
+ print ( """x86_64-apple-darwin11.0.0""" )
73
74
74
75
75
76
# Clang build at r154331 (for example).
76
77
class Clang_r154331 (LLVMCompiler ):
77
78
compiler_name = "clang-r154331"
78
79
79
80
def print_verbose_info (self ):
80
- print >> sys . stderr , """\
81
+ print ( """\
81
82
clang version 3.1 (trunk 154331) (llvm/trunk 154329)
82
83
Target: x86_64-apple-darwin11.3.0
83
84
Thread model: posix
84
85
InstalledDir: /home/foo/bin
85
- """
86
- print >> sys . stderr , """\
86
+ """ , file = sys . stderr )
87
+ print ( """\
87
88
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
88
- g_program ,)
89
+ g_program ,), file = sys . stderr )
89
90
90
91
91
92
class Clang_r154332 (LLVMCompiler ):
92
93
compiler_name = "clang-r154332"
93
94
94
95
def print_verbose_info (self ):
95
- print >> sys . stderr , """\
96
+ print ( """\
96
97
clang version 3.1 (trunk 154332) (llvm/trunk 154329)
97
98
Target: x86_64-apple-darwin11.3.0
98
99
Thread model: posix
99
100
InstalledDir: /home/foo/bin
100
- """
101
- print >> sys . stderr , """\
101
+ """ , file = sys . stderr )
102
+ print ( """\
102
103
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
103
- g_program ,)
104
+ g_program ,), file = sys . stderr )
104
105
105
106
106
107
# Clang build from a git repository.
107
108
class Clang_git (LLVMCompiler ):
108
109
compiler_name = "clang-git"
109
110
110
111
def print_verbose_info (self ):
111
- print >> sys . stderr , """\
112
+ print ( """\
112
113
clang version 3.1\
113
114
(git:/git/clang.git 37ce0feee598d82e7220fa0a4b110619cae6ea72)\
114
115
(git:/git/llvm.git 60fca4f64e697ad834ce7ee8c2e478cae394c7dc)
115
116
Target: arm-apple-darwin11.4.0
116
117
Thread model: posix
117
118
InstalledDir: /home/foo/bin
118
- """
119
- print >> sys . stderr , """\
119
+ """ , file = sys . stderr )
120
+ print ( """\
120
121
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
121
- g_program ,)
122
+ g_program ,), file = sys . stderr )
122
123
123
124
124
125
# Clang build from a git repository.
125
126
class Clang_git_2 (LLVMCompiler ):
126
127
compiler_name = "clang-git-2"
127
128
128
129
def print_verbose_info (self ):
129
- print >> sys . stderr , """\
130
+ print ( """\
130
131
clang version 3.2\
131
132
(/d/g/pz/clang.git git:/git/pz/clang.git 8ab09316f63ea99ff23b2684c454b1008b8d5f10)\
132
133
(http://llvm.org/git/llvm.git /d/g/pz/llvm.git git:/git/pb/llvm.git 7c53f795961cc2d35b85d315aadb2ac135a0fdb2)
133
134
Target: x86_64-apple-darwin12.2.0
134
- Thread model: posix"""
135
- print >> sys . stderr , """\
135
+ Thread model: posix""" , file = sys . stderr )
136
+ print ( """\
136
137
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
137
- g_program ,)
138
+ g_program ,), file = sys . stderr )
138
139
139
140
140
141
class AppleClang_138_1 (LLVMCompiler ):
141
142
compiler_name = "apple-clang-138.1"
142
143
143
144
def print_verbose_info (self ):
144
- print >> sys . stderr , """\
145
+ print ( """\
145
146
Apple clang version 2.0 (tags/Apple/clang-138.1) (based on LLVM 2.9svn)
146
147
Target: x86_64-apple-darwin11.3.0
147
148
Thread model: posix
148
- InstalledDir: /home/foo/bin"""
149
- print >> sys . stderr , """\
149
+ InstalledDir: /home/foo/bin""" , file = sys . stderr )
150
+ print ( """\
150
151
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
151
- g_program ,)
152
+ g_program ,), file = sys . stderr )
152
153
153
154
154
155
fake_compilers = dict ((value .compiler_name , value )
@@ -160,26 +161,26 @@ class ClangNoInfo(LLVMCompiler):
160
161
compiler_name = "clang-no-info"
161
162
162
163
def print_verbose_info (self ):
163
- print >> sys . stderr , """\
164
+ print ( """\
164
165
clang version 3.2
165
166
Target: x86_64-bla-bla
166
- Thread model: posix"""
167
- print >> sys . stderr , """\
167
+ Thread model: posix""" , file = sys . stderr )
168
+ print ( """\
168
169
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
169
- g_program ,)
170
+ g_program ,), file = sys . stderr )
170
171
171
172
172
173
class GenericLLVMCompiler (LLVMCompiler ):
173
174
compiler_name = "llvm-compiler"
174
175
175
176
def print_verbose_info (self ):
176
- print >> sys . stderr , """\
177
+ print ( """\
177
178
LLVM version 3.3 (git:/git/pz/clang.git 597522d740374f093a089a2acbec5b20466b2f34) (/d/g/pz/llvm git:/git/pz/llvm.git 6e95d969734af111bb33bcec0bcc27fd803a3b76)
178
179
Target: x86_64-apple-darwin12.3.0
179
- Thread model: posix""" # noqa
180
- print >> sys . stderr , """\
180
+ Thread model: posix""" , file = sys . stderr ) # noqa
181
+ print ( """\
181
182
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
182
- g_program ,)
183
+ g_program ,), file = sys . stderr )
183
184
184
185
185
186
fake_compilers = dict ((value .compiler_name , value )
0 commit comments