let it compile with clang (dirty const_cast, code is really not const correct
This commit is contained in:
parent
ed3a9e8bbb
commit
c4682a73a6
@ -1,6 +1,7 @@
|
||||
$OpenBSD: patch-intel2gas_cc,v 1.1 2010/06/08 07:36:20 espie Exp $
|
||||
--- intel2gas.cc.orig Tue Jun 8 09:34:27 2010
|
||||
+++ intel2gas.cc Tue Jun 8 09:34:53 2010
|
||||
$OpenBSD: patch-intel2gas_cc,v 1.2 2017/05/25 11:15:41 espie Exp $
|
||||
Index: intel2gas.cc
|
||||
--- intel2gas.cc.orig
|
||||
+++ intel2gas.cc
|
||||
@@ -57,7 +57,7 @@ syntaxlist_t *findSyntax(char const *name)
|
||||
int counter = 0;
|
||||
char* prev = 0;
|
||||
@ -10,3 +11,44 @@ $OpenBSD: patch-intel2gas_cc,v 1.1 2010/06/08 07:36:20 espie Exp $
|
||||
printf("Error %d, prev=%s\n", counter, prev);
|
||||
break;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ static int numberparse(char const *tag, char const *in
|
||||
return len;
|
||||
}
|
||||
|
||||
-static int str_parse(syntaxlist_t *s, char *parse, char *outline);
|
||||
+static int str_parse(syntaxlist_t *s, const char *parse, char *outline);
|
||||
|
||||
static int parsematch(char *text, char *parse)
|
||||
{
|
||||
@@ -394,8 +394,9 @@ static int parsematch(char *text, char *parse)
|
||||
}
|
||||
|
||||
|
||||
-static int str_parse(syntaxlist_t *sl, char *parse, char *outline)
|
||||
+static int str_parse(syntaxlist_t *sl, const char *p, char *outline)
|
||||
{
|
||||
+ char *parse = const_cast<char *>(p); // XXX
|
||||
*outline = '\0';
|
||||
parse = str_skipspace(parse);
|
||||
if (str_empty(parse))
|
||||
@@ -446,9 +447,9 @@ static void findComment(char const *source, comment_ma
|
||||
{
|
||||
match.at = NULL;
|
||||
for (int c=0; c<comments; c++) {
|
||||
- char *pos = strstr(source, comment[c].src);
|
||||
+ const char *pos = strstr(source, comment[c].src);
|
||||
if (!match.at || (pos && pos < match.at)) {
|
||||
- match.at = pos;
|
||||
+ match.at = const_cast<char *>(pos);
|
||||
match.data = &comment[c];
|
||||
}
|
||||
}
|
||||
@@ -535,7 +536,7 @@ static void clean_clobber_list(void)
|
||||
if (str_empty(var)) return;
|
||||
|
||||
static struct {
|
||||
- char *reg;
|
||||
+ const char *reg;
|
||||
int mask;
|
||||
} reglist[] = {
|
||||
{"bp",0x40000},{"ebp",0xc0000},
|
||||
|
22
lang/intel2gas/patches/patch-strhandle_cc
Normal file
22
lang/intel2gas/patches/patch-strhandle_cc
Normal file
@ -0,0 +1,22 @@
|
||||
$OpenBSD: patch-strhandle_cc,v 1.1 2017/05/25 11:15:41 espie Exp $
|
||||
|
||||
Index: strhandle.cc
|
||||
--- strhandle.cc.orig
|
||||
+++ strhandle.cc
|
||||
@@ -24,14 +24,14 @@ char *str_cutat(char *str, char cut)
|
||||
/* Like str_cutat, but the beginning of str is copied to buffer at left */
|
||||
char *str_splitat(char const * const str, char *left, char cut)
|
||||
{
|
||||
- char *pos = strchr(str,cut);
|
||||
+ const char *pos = strchr(str,cut);
|
||||
if (!pos) {
|
||||
strcpy(left,str);
|
||||
return NULL;
|
||||
}
|
||||
strncpy(left,str,pos-str);
|
||||
left[pos-str] = '\0';
|
||||
- return pos+1;
|
||||
+ return const_cast<char *>(pos+1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user