Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
3bcef5ac
Commit
3bcef5ac
authored
Apr 27, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix islocalname on windows
Fixes #732. R=ken2 CC=golang-dev
https://golang.org/cl/956050
parent
646301a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
go.h
src/cmd/gc/go.h
+6
-0
lex.c
src/cmd/gc/lex.c
+22
-1
No files found.
src/cmd/gc/go.h
View file @
3bcef5ac
...
...
@@ -1242,3 +1242,9 @@ 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 @
3bcef5ac
...
...
@@ -24,6 +24,7 @@ main(int argc, char *argv[])
{
int
i
,
c
;
NodeList
*
l
;
char
*
p
;
localpkg
=
mkpkg
(
strlit
(
""
));
localpkg
->
prefix
=
"
\"\"
"
;
...
...
@@ -80,6 +81,13 @@ main(int argc, char *argv[])
if
(
getwd
(
pathname
,
999
)
==
0
)
strcpy
(
pathname
,
"/???"
);
if
(
systemtype
(
SysWindows
))
{
// Canonicalize path by converting \ to / (Windows accepts both).
for
(
p
=
pathname
;
*
p
;
p
++
)
if
(
*
p
==
'\\'
)
*
p
=
'/'
;
}
fmtinstall
(
'O'
,
Oconv
);
// node opcodes
fmtinstall
(
'E'
,
Econv
);
// etype opcodes
fmtinstall
(
'J'
,
Jconv
);
// all the node flags
...
...
@@ -239,8 +247,11 @@ addidir(char* dir)
int
islocalname
(
Strlit
*
name
)
{
if
(
name
->
len
>=
1
&&
name
->
s
[
0
]
==
'/'
)
if
(
systemtype
(
SysUnix
)
&&
name
->
len
>=
1
&&
name
->
s
[
0
]
==
'/'
)
return
1
;
if
(
systemtype
(
SysWindows
)
&&
name
->
len
>=
3
&&
isalpha
(
name
->
s
[
0
])
&&
name
->
s
[
1
]
==
':'
&&
name
->
s
[
2
]
==
'/'
)
return
1
;
if
(
name
->
len
>=
2
&&
strncmp
(
name
->
s
,
"./"
,
2
)
==
0
)
return
1
;
if
(
name
->
len
>=
3
&&
strncmp
(
name
->
s
,
"../"
,
3
)
==
0
)
...
...
@@ -1662,3 +1673,13 @@ 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