Skip to content

Commit 17aab9a

Browse files
jaladreipsigcbot
authored andcommitted
Prepare VISA for C++20
Prepare VISA for C++20
1 parent 2d36934 commit 17aab9a

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

visa/CISA.l

+6-4
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ void resetGlobalVariables() {
197197
".input" {TRACE("** INPUT"); return DIRECTIVE_INPUT;}
198198
"."implicit[a-zA-Z0-9_\-$@?]* {
199199
TRACE("** DIRECTIVE_IMPLICIT");
200-
CISAlval.string = strdup(yytext);
201-
CISAlval.string[yyleng] = '\0';
200+
char* yytext_dup = strdup(yytext);
201+
yytext_dup[yyleng] = '\0';
202+
CISAlval.string = yytext_dup;
202203
return DIRECTIVE_IMPLICIT;
203204
}
204205
".function" {TRACE("** FUNCTION"); return DIRECTIVE_FUNC;}
@@ -877,8 +878,9 @@ lifetime"."end {
877878

878879
^[a-zA-Z_$@?][a-zA-Z0-9_\-$@?]*: {
879880
TRACE("** LABEL");
880-
CISAlval.string = strdup(yytext);
881-
CISAlval.string[yyleng - 1] = '\0';
881+
char* yytext_dup = strdup(yytext);
882+
yytext_dup[yyleng - 1] = '\0';
883+
CISAlval.string = yytext_dup;
882884
return LABEL;
883885
}
884886

visa/CISA.y

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ std::vector<attr_gen_struct*> AttrOptVar;
8989
char * decoded;
9090
size_t len;
9191
} strlit;
92-
char * string;
92+
const char * string;
9393

9494
VISA_Type type;
9595
ISA_Opcode opcode;
@@ -149,7 +149,7 @@ std::vector<attr_gen_struct*> AttrOptVar;
149149
} regAccess;
150150

151151
struct {
152-
char * aliasname;
152+
const char * aliasname;
153153
int offset;
154154
} alias;
155155

@@ -251,7 +251,7 @@ std::vector<attr_gen_struct*> AttrOptVar;
251251
int surfaceIndex;
252252
} lsc_addr_model;
253253
struct sampler_base_struct {
254-
char *base;
254+
const char *base;
255255
unsigned int offset;
256256
} sampler_base;
257257

visa/G4_Operand.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ class G4_SrcRegRegion final : public G4_Operand {
562562
G4_SrcRegRegion& operator=(const G4_SrcRegRegion&) = delete;
563563
void *operator new(size_t sz, Mem_Manager &m) { return m.alloc(sz); }
564564

565-
bool operator==(const G4_SrcRegRegion &other) {
565+
bool operator==(const G4_SrcRegRegion &other) const {
566566
if (base != other.base || regOff != other.regOff ||
567567
subRegOff != other.subRegOff ||
568568
desc->vertStride != other.desc->vertStride ||

0 commit comments

Comments
 (0)