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
diff --git a/src/IceInst.h b/src/IceInst.h index 3067c26..fd0eeea 100644 --- a/src/IceInst.h +++ b/src/IceInst.h
@@ -161,6 +161,7 @@ #define X(tag, str, commutative) tag, ICEINSTARITHMETIC_TABLE #undef X + _num }; static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest, @@ -287,6 +288,7 @@ #define X(tag, str) tag, ICEINSTCAST_TABLE #undef X + _num }; static InstCast *create(Cfg *Func, OpKind CastKind, Variable *Dest, @@ -314,6 +316,7 @@ #define X(tag, str) tag, ICEINSTFCMP_TABLE #undef X + _num }; static InstFcmp *create(Cfg *Func, FCond Condition, Variable *Dest, @@ -342,6 +345,7 @@ #define X(tag, str) tag, ICEINSTICMP_TABLE #undef X + _num }; static InstIcmp *create(Cfg *Func, ICond Condition, Variable *Dest,
diff --git a/src/IceInstX8632.def b/src/IceInstX8632.def index 665dd8d..d5e99c3 100644 --- a/src/IceInstX8632.def +++ b/src/IceInstX8632.def
@@ -22,19 +22,19 @@ 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_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_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_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_xmm0, /*none*/, "xmm0", , , 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_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_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_xmm7, = Reg_xmm0 + 7, "xmm7", , , 1, 0, 0, 0, 0, 0, 1) \ + 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_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_ah, = Reg_edi + 1, "???", "" , "ah", 0, 0, 0, 0, 1, 0, 0) \ + 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_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_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_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) \ //#define X(val, init, name, name16, name8, scratch, preserved, stackptr, // frameptr, isI8, isInt, isFP) @@ -57,15 +57,14 @@ #define ICETYPEX8632_TABLE \ /* tag, cvt, sdss, width */ \ - X(IceType_void, "?", , "???") \ - X(IceType_i1, "i", , "byte ptr") \ - X(IceType_i8, "i", , "byte ptr") \ - X(IceType_i16, "i", , "word ptr") \ - X(IceType_i32, "i", , "dword ptr") \ - X(IceType_i64, "i", , "qword ptr") \ + X(IceType_void, "?", "" , "???") \ + X(IceType_i1, "i", "" , "byte ptr") \ + X(IceType_i8, "i", "" , "byte ptr") \ + X(IceType_i16, "i", "" , "word ptr") \ + X(IceType_i32, "i", "" , "dword ptr") \ + X(IceType_i64, "i", "" , "qword ptr") \ X(IceType_f32, "s", "ss", "dword ptr") \ X(IceType_f64, "d", "sd", "qword ptr") \ - X(IceType_NUM, "?", , "???") \ //#define X(tag, cvt, sdss, width) #endif // SUBZERO_SRC_ICEINSTX8632_DEF
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp index 8ee5ac9..4b8bf27 100644 --- a/src/IceTargetLoweringX8632.cpp +++ b/src/IceTargetLoweringX8632.cpp
@@ -101,6 +101,7 @@ #define X(val, dflt, swap, C1, C2) _tmp_##val, FCMPX8632_TABLE #undef X + _num }; // Define a set of constants based on high-level table entries. #define X(tag, str) static const int _table1_##tag = InstFcmp::tag; @@ -128,6 +129,7 @@ #define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val, ICMPX8632_TABLE #undef X + _num }; // Define a set of constants based on high-level table entries. #define X(tag, str) static const int _table1_##tag = InstIcmp::tag; @@ -155,6 +157,7 @@ #define X(tag, cvt, sdss, width) _tmp_##tag, ICETYPEX8632_TABLE #undef X + _num }; // Define a set of constants based on high-level table entries. #define X(tag, size, align, str) static const int _table1_##tag = tag; @@ -276,14 +279,14 @@ static IceString RegNames8[] = { #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ frameptr, isI8, isInt, isFP) \ - "" name8, + name8, REGX8632_TABLE #undef X }; static IceString RegNames16[] = { #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ frameptr, isI8, isInt, isFP) \ - "" name16, + name16, REGX8632_TABLE #undef X }; @@ -761,6 +764,9 @@ Operand *Src1Hi = hiOperand(Src1); Variable *T_Lo = NULL, *T_Hi = NULL; switch (Inst->getOp()) { + case InstArithmetic::_num: + llvm_unreachable("Unknown arithmetic operator"); + break; case InstArithmetic::Add: _mov(T_Lo, Src0Lo); _add(T_Lo, Src1Lo); @@ -979,6 +985,9 @@ Variable *T_edx = NULL; Variable *T = NULL; switch (Inst->getOp()) { + case InstArithmetic::_num: + llvm_unreachable("Unknown arithmetic operator"); + break; case InstArithmetic::Add: _mov(T, Src0); _add(T, Src1);
diff --git a/src/IceTypes.def b/src/IceTypes.def index fc48b9d..3faa5f5 100644 --- a/src/IceTypes.def +++ b/src/IceTypes.def
@@ -26,7 +26,6 @@ X(IceType_i64, 8, 1, "i64") \ X(IceType_f32, 4, 4, "float") \ X(IceType_f64, 8, 8, "double") \ - X(IceType_NUM, 0, 0, "<invalid>") \ //#define X(tag, size, align, str) #endif // SUBZERO_SRC_ICETYPES_DEF
diff --git a/src/IceTypes.h b/src/IceTypes.h index 21c399d..a919465 100644 --- a/src/IceTypes.h +++ b/src/IceTypes.h
@@ -24,6 +24,7 @@ #define X(tag, size, align, str) tag, ICETYPE_TABLE #undef X + IceType_NUM }; enum TargetArch {