Commit 4376d292 by Jim Stichnoth

Fix g++ -pedantic warnings.

1. Comma-terminated enumerator lists. 2. Empty macro arguments. 3. Variable-length arrays. The first issue is definitely hitting the Mac bots. The other two issues will quite possibly following that. BUG= none R=jfb@chromium.org Review URL: https://codereview.chromium.org/296823013
parent f61d5b22
...@@ -161,6 +161,7 @@ public: ...@@ -161,6 +161,7 @@ public:
#define X(tag, str, commutative) tag, #define X(tag, str, commutative) tag,
ICEINSTARITHMETIC_TABLE ICEINSTARITHMETIC_TABLE
#undef X #undef X
_num
}; };
static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest, static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest,
...@@ -287,6 +288,7 @@ public: ...@@ -287,6 +288,7 @@ public:
#define X(tag, str) tag, #define X(tag, str) tag,
ICEINSTCAST_TABLE ICEINSTCAST_TABLE
#undef X #undef X
_num
}; };
static InstCast *create(Cfg *Func, OpKind CastKind, Variable *Dest, static InstCast *create(Cfg *Func, OpKind CastKind, Variable *Dest,
...@@ -314,6 +316,7 @@ public: ...@@ -314,6 +316,7 @@ public:
#define X(tag, str) tag, #define X(tag, str) tag,
ICEINSTFCMP_TABLE ICEINSTFCMP_TABLE
#undef X #undef X
_num
}; };
static InstFcmp *create(Cfg *Func, FCond Condition, Variable *Dest, static InstFcmp *create(Cfg *Func, FCond Condition, Variable *Dest,
...@@ -342,6 +345,7 @@ public: ...@@ -342,6 +345,7 @@ public:
#define X(tag, str) tag, #define X(tag, str) tag,
ICEINSTICMP_TABLE ICEINSTICMP_TABLE
#undef X #undef X
_num
}; };
static InstIcmp *create(Cfg *Func, ICond Condition, Variable *Dest, static InstIcmp *create(Cfg *Func, ICond Condition, Variable *Dest,
......
...@@ -22,19 +22,19 @@ ...@@ -22,19 +22,19 @@
X(Reg_ecx, = Reg_eax + 1, "ecx", "cx", "cl", 1, 0, 0, 0, 1, 1, 0) \ X(Reg_ecx, = Reg_eax + 1, "ecx", "cx", "cl", 1, 0, 0, 0, 1, 1, 0) \
X(Reg_edx, = Reg_eax + 2, "edx", "dx", "dl", 1, 0, 0, 0, 1, 1, 0) \ X(Reg_edx, = Reg_eax + 2, "edx", "dx", "dl", 1, 0, 0, 0, 1, 1, 0) \
X(Reg_ebx, = Reg_eax + 3, "ebx", "bx", "bl", 0, 1, 0, 0, 1, 1, 0) \ X(Reg_ebx, = Reg_eax + 3, "ebx", "bx", "bl", 0, 1, 0, 0, 1, 1, 0) \
X(Reg_esp, = Reg_eax + 4, "esp", "sp", , 0, 0, 1, 0, 0, 1, 0) \ X(Reg_esp, = Reg_eax + 4, "esp", "sp", "" , 0, 0, 1, 0, 0, 1, 0) \
X(Reg_ebp, = Reg_eax + 5, "ebp", "bp", , 0, 1, 0, 1, 0, 1, 0) \ X(Reg_ebp, = Reg_eax + 5, "ebp", "bp", "" , 0, 1, 0, 1, 0, 1, 0) \
X(Reg_esi, = Reg_eax + 6, "esi", "si", , 0, 1, 0, 0, 0, 1, 0) \ X(Reg_esi, = Reg_eax + 6, "esi", "si", "" , 0, 1, 0, 0, 0, 1, 0) \
X(Reg_edi, = Reg_eax + 7, "edi", "di", , 0, 1, 0, 0, 0, 1, 0) \ X(Reg_edi, = Reg_eax + 7, "edi", "di", "" , 0, 1, 0, 0, 0, 1, 0) \
X(Reg_ah, /*none*/, "???", , "ah", 0, 0, 0, 0, 1, 0, 0) \ X(Reg_ah, = Reg_edi + 1, "???", "" , "ah", 0, 0, 0, 0, 1, 0, 0) \
X(Reg_xmm0, /*none*/, "xmm0", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm0, = Reg_ah + 1, "xmm0", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm1, = Reg_xmm0 + 1, "xmm1", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm1, = Reg_xmm0 + 1, "xmm1", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm2, = Reg_xmm0 + 2, "xmm2", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm2, = Reg_xmm0 + 2, "xmm2", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm3, = Reg_xmm0 + 3, "xmm3", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm3, = Reg_xmm0 + 3, "xmm3", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm4, = Reg_xmm0 + 4, "xmm4", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm4, = Reg_xmm0 + 4, "xmm4", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm5, = Reg_xmm0 + 5, "xmm5", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm5, = Reg_xmm0 + 5, "xmm5", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm6, = Reg_xmm0 + 6, "xmm6", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm6, = Reg_xmm0 + 6, "xmm6", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
X(Reg_xmm7, = Reg_xmm0 + 7, "xmm7", , , 1, 0, 0, 0, 0, 0, 1) \ X(Reg_xmm7, = Reg_xmm0 + 7, "xmm7", "" , "" , 1, 0, 0, 0, 0, 0, 1) \
//#define X(val, init, name, name16, name8, scratch, preserved, stackptr, //#define X(val, init, name, name16, name8, scratch, preserved, stackptr,
// frameptr, isI8, isInt, isFP) // frameptr, isI8, isInt, isFP)
...@@ -57,15 +57,14 @@ ...@@ -57,15 +57,14 @@
#define ICETYPEX8632_TABLE \ #define ICETYPEX8632_TABLE \
/* tag, cvt, sdss, width */ \ /* tag, cvt, sdss, width */ \
X(IceType_void, "?", , "???") \ X(IceType_void, "?", "" , "???") \
X(IceType_i1, "i", , "byte ptr") \ X(IceType_i1, "i", "" , "byte ptr") \
X(IceType_i8, "i", , "byte ptr") \ X(IceType_i8, "i", "" , "byte ptr") \
X(IceType_i16, "i", , "word ptr") \ X(IceType_i16, "i", "" , "word ptr") \
X(IceType_i32, "i", , "dword ptr") \ X(IceType_i32, "i", "" , "dword ptr") \
X(IceType_i64, "i", , "qword ptr") \ X(IceType_i64, "i", "" , "qword ptr") \
X(IceType_f32, "s", "ss", "dword ptr") \ X(IceType_f32, "s", "ss", "dword ptr") \
X(IceType_f64, "d", "sd", "qword ptr") \ X(IceType_f64, "d", "sd", "qword ptr") \
X(IceType_NUM, "?", , "???") \
//#define X(tag, cvt, sdss, width) //#define X(tag, cvt, sdss, width)
#endif // SUBZERO_SRC_ICEINSTX8632_DEF #endif // SUBZERO_SRC_ICEINSTX8632_DEF
...@@ -101,6 +101,7 @@ void xMacroIntegrityCheck() { ...@@ -101,6 +101,7 @@ void xMacroIntegrityCheck() {
#define X(val, dflt, swap, C1, C2) _tmp_##val, #define X(val, dflt, swap, C1, C2) _tmp_##val,
FCMPX8632_TABLE FCMPX8632_TABLE
#undef X #undef X
_num
}; };
// Define a set of constants based on high-level table entries. // Define a set of constants based on high-level table entries.
#define X(tag, str) static const int _table1_##tag = InstFcmp::tag; #define X(tag, str) static const int _table1_##tag = InstFcmp::tag;
...@@ -128,6 +129,7 @@ void xMacroIntegrityCheck() { ...@@ -128,6 +129,7 @@ void xMacroIntegrityCheck() {
#define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val, #define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val,
ICMPX8632_TABLE ICMPX8632_TABLE
#undef X #undef X
_num
}; };
// Define a set of constants based on high-level table entries. // Define a set of constants based on high-level table entries.
#define X(tag, str) static const int _table1_##tag = InstIcmp::tag; #define X(tag, str) static const int _table1_##tag = InstIcmp::tag;
...@@ -155,6 +157,7 @@ void xMacroIntegrityCheck() { ...@@ -155,6 +157,7 @@ void xMacroIntegrityCheck() {
#define X(tag, cvt, sdss, width) _tmp_##tag, #define X(tag, cvt, sdss, width) _tmp_##tag,
ICETYPEX8632_TABLE ICETYPEX8632_TABLE
#undef X #undef X
_num
}; };
// Define a set of constants based on high-level table entries. // Define a set of constants based on high-level table entries.
#define X(tag, size, align, str) static const int _table1_##tag = tag; #define X(tag, size, align, str) static const int _table1_##tag = tag;
...@@ -276,14 +279,14 @@ IceString TargetX8632::getRegName(SizeT RegNum, Type Ty) const { ...@@ -276,14 +279,14 @@ IceString TargetX8632::getRegName(SizeT RegNum, Type Ty) const {
static IceString RegNames8[] = { static IceString RegNames8[] = {
#define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \
frameptr, isI8, isInt, isFP) \ frameptr, isI8, isInt, isFP) \
"" name8, name8,
REGX8632_TABLE REGX8632_TABLE
#undef X #undef X
}; };
static IceString RegNames16[] = { static IceString RegNames16[] = {
#define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \
frameptr, isI8, isInt, isFP) \ frameptr, isI8, isInt, isFP) \
"" name16, name16,
REGX8632_TABLE REGX8632_TABLE
#undef X #undef X
}; };
...@@ -761,6 +764,9 @@ void TargetX8632::lowerArithmetic(const InstArithmetic *Inst) { ...@@ -761,6 +764,9 @@ void TargetX8632::lowerArithmetic(const InstArithmetic *Inst) {
Operand *Src1Hi = hiOperand(Src1); Operand *Src1Hi = hiOperand(Src1);
Variable *T_Lo = NULL, *T_Hi = NULL; Variable *T_Lo = NULL, *T_Hi = NULL;
switch (Inst->getOp()) { switch (Inst->getOp()) {
case InstArithmetic::_num:
llvm_unreachable("Unknown arithmetic operator");
break;
case InstArithmetic::Add: case InstArithmetic::Add:
_mov(T_Lo, Src0Lo); _mov(T_Lo, Src0Lo);
_add(T_Lo, Src1Lo); _add(T_Lo, Src1Lo);
...@@ -979,6 +985,9 @@ void TargetX8632::lowerArithmetic(const InstArithmetic *Inst) { ...@@ -979,6 +985,9 @@ void TargetX8632::lowerArithmetic(const InstArithmetic *Inst) {
Variable *T_edx = NULL; Variable *T_edx = NULL;
Variable *T = NULL; Variable *T = NULL;
switch (Inst->getOp()) { switch (Inst->getOp()) {
case InstArithmetic::_num:
llvm_unreachable("Unknown arithmetic operator");
break;
case InstArithmetic::Add: case InstArithmetic::Add:
_mov(T, Src0); _mov(T, Src0);
_add(T, Src1); _add(T, Src1);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
X(IceType_i64, 8, 1, "i64") \ X(IceType_i64, 8, 1, "i64") \
X(IceType_f32, 4, 4, "float") \ X(IceType_f32, 4, 4, "float") \
X(IceType_f64, 8, 8, "double") \ X(IceType_f64, 8, 8, "double") \
X(IceType_NUM, 0, 0, "<invalid>") \
//#define X(tag, size, align, str) //#define X(tag, size, align, str)
#endif // SUBZERO_SRC_ICETYPES_DEF #endif // SUBZERO_SRC_ICETYPES_DEF
...@@ -24,6 +24,7 @@ enum Type { ...@@ -24,6 +24,7 @@ enum Type {
#define X(tag, size, align, str) tag, #define X(tag, size, align, str) tag,
ICETYPE_TABLE ICETYPE_TABLE
#undef X #undef X
IceType_NUM
}; };
enum TargetArch { enum TargetArch {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment