Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
8a958216
Commit
8a958216
authored
Jul 16, 2010
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgo: If CC is set in environment, use it rather than "gcc".
R=rsc CC=golang-dev
https://golang.org/cl/1842042
parent
444066e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
src/cmd/cgo/gcc.go
src/cmd/cgo/gcc.go
+12
-2
No files found.
src/cmd/cgo/gcc.go
View file @
8a958216
...
...
@@ -450,6 +450,16 @@ func (p *Package) rewriteRef(f *File) {
}
}
// gccName returns the name of the compiler to run. Use CC if set in
// the environment, otherwise just "gcc".
func
(
p
*
Package
)
gccName
()
(
ret
string
)
{
if
ret
=
os
.
Getenv
(
"CC"
);
ret
==
""
{
ret
=
"gcc"
}
return
}
// gccMachine returns the gcc -m flag to use, either "-m32" or "-m64".
func
(
p
*
Package
)
gccMachine
()
string
{
if
p
.
PtrSize
==
8
{
...
...
@@ -464,7 +474,7 @@ const gccTmp = "_cgo_.o"
// the input.
func
(
p
*
Package
)
gccCmd
()
[]
string
{
return
[]
string
{
"gcc"
,
p
.
gccName
()
,
p
.
gccMachine
(),
"-Wall"
,
// many warnings
"-Werror"
,
// warnings are errors
...
...
@@ -506,7 +516,7 @@ func (p *Package) gccDebug(stdin []byte) *dwarf.Data {
// #defines that gcc encountered while processing the input
// and its included files.
func
(
p
*
Package
)
gccDefines
(
stdin
[]
byte
)
string
{
base
:=
[]
string
{
"gcc"
,
p
.
gccMachine
(),
"-E"
,
"-dM"
,
"-xc"
,
"-"
}
base
:=
[]
string
{
p
.
gccName
()
,
p
.
gccMachine
(),
"-E"
,
"-dM"
,
"-xc"
,
"-"
}
stdout
,
_
:=
runGcc
(
stdin
,
concat
(
base
,
p
.
GccOptions
))
return
stdout
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment