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
69a2e1dc
Commit
69a2e1dc
authored
Apr 27, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: better windows detection
R=ken2 CC=golang-dev
https://golang.org/cl/944043
parent
8553b9c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
src/cmd/gc/go.h
src/cmd/gc/go.h
+0
-7
src/cmd/gc/lex.c
src/cmd/gc/lex.c
+8
-13
No files found.
src/cmd/gc/go.h
View file @
69a2e1dc
...
...
@@ -1241,10 +1241,3 @@ int duintptr(Sym *s, int off, uint64 v);
int
duintxx
(
Sym
*
s
,
int
off
,
uint64
v
,
int
wid
);
void
genembedtramp
(
Type
*
,
Type
*
,
Sym
*
);
int
gen_as_init
(
Node
*
);
enum
{
SysUnix
=
1
<<
1
,
SysWindows
=
1
<<
2
,
};
int
systemtype
(
int
);
src/cmd/gc/lex.c
View file @
69a2e1dc
...
...
@@ -8,6 +8,8 @@
#include <ar.h>
extern
int
yychar
;
int
windows
;
void
lexfini
(
void
);
void
yytinit
(
void
);
...
...
@@ -81,7 +83,10 @@ main(int argc, char *argv[])
if
(
getwd
(
pathname
,
999
)
==
0
)
strcpy
(
pathname
,
"/???"
);
if
(
systemtype
(
SysWindows
))
{
if
(
isalpha
(
pathname
[
0
])
&&
pathname
[
1
]
==
':'
)
{
// On Windows.
windows
=
1
;
// Canonicalize path by converting \ to / (Windows accepts both).
for
(
p
=
pathname
;
*
p
;
p
++
)
if
(
*
p
==
'\\'
)
...
...
@@ -247,9 +252,9 @@ addidir(char* dir)
int
islocalname
(
Strlit
*
name
)
{
if
(
systemtype
(
SysUnix
)
&&
name
->
len
>=
1
&&
name
->
s
[
0
]
==
'/'
)
if
(
!
windows
&&
name
->
len
>=
1
&&
name
->
s
[
0
]
==
'/'
)
return
1
;
if
(
systemtype
(
SysWindows
)
&&
name
->
len
>=
3
&&
if
(
windows
&&
name
->
len
>=
3
&&
isalpha
(
name
->
s
[
0
])
&&
name
->
s
[
1
]
==
':'
&&
name
->
s
[
2
]
==
'/'
)
return
1
;
if
(
name
->
len
>=
2
&&
strncmp
(
name
->
s
,
"./"
,
2
)
==
0
)
...
...
@@ -1673,13 +1678,3 @@ mkpackage(char* pkgname)
outfile
=
smprint
(
"%s.%c"
,
namebuf
,
thechar
);
}
}
int
systemtype
(
int
sys
)
{
#ifdef __MINGW32__
return
sys
&
SysWindows
;
#else
return
sys
&
SysUnix
;
#endif
}
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