Skip to content

Commit

Permalink
[refactor] Suppress fall through warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Oct 15, 2018
1 parent b1f078e commit 72cda5d
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 6 deletions.
Expand Up @@ -149,6 +149,7 @@ public int compareTo(Immediate o) {
}
}

@SuppressWarnings("fallthrough")
private static Immediate[] buildImmediateTable() {
final int nrImmediates = 5334;
final Immediate[] table = new Immediate[nrImmediates];
Expand Down
Expand Up @@ -1276,6 +1276,7 @@ public final void nop() {
nop(1);
}

@SuppressWarnings("fallthrough")
public void nop(int i) {
if (AsmOptions.UseNormalNop) {
assert i > 0 : " ";
Expand Down
Expand Up @@ -70,6 +70,7 @@ public int currentDisplacementPosition() {
return currentDisplacementPosition;
}

@SuppressWarnings("fallthrough")
public void decodePosition(int inst) {

assert inst >= 0 && inst < code.length;
Expand Down
Expand Up @@ -280,6 +280,7 @@ private boolean generateTag(T1XTemplateTag tag, AdviceType at) {
* and we may decide here to throw it away if we are not generating that advice.
*/
@Override
@SuppressWarnings("fallthrough")
public void generate(T1XTemplateTag tag, AdviceType at, Object... args) {
byteArrayOut.setTag(tag);
if (!generateTag(tag, at)) {
Expand Down Expand Up @@ -584,10 +585,9 @@ public void generate(T1XTemplateTag tag, AdviceType at, Object... args) {

case NEW_HYBRID:
methodName = "New";
// Checkstyle: stop
// fall through
case NEW:
case NEW$init:
// Checkstyle: resume
assert adviceType == AdviceType.AFTER;
generateNew();
break;
Expand Down
Expand Up @@ -800,6 +800,7 @@ private String arg(int slot) {
}
}

@SuppressWarnings("fallthrough")
private void processTraceRecord() throws TraceException {
String arg1 = arg(1);
String arg2 = arg(2);
Expand Down
1 change: 1 addition & 0 deletions com.sun.c1x/src/com/sun/c1x/graph/BlockMap.java
Expand Up @@ -356,6 +356,7 @@ public CiBitMap getStoresInLoops() {
return storesInLoops;
}

@SuppressWarnings("fallthrough")
void iterateOverBytecodes() {
// iterate over the bytecodes top to bottom.
// mark the entrypoints of basic blocks and build lists of successors for
Expand Down
Expand Up @@ -951,6 +951,7 @@ private ConditionFlag convertCondition(Condition condition) {
}

@Override
@SuppressWarnings("fallthrough")
protected void emitCompare(Condition condition, CiValue opr1, CiValue opr2, LIROp2 op) {
// Checkstyle: off
assert Util.archKindsEqual(opr1.kind.stackKind(), opr2.kind.stackKind()) || (opr1.kind == CiKind.Long && opr2.kind == CiKind.Int) : "nonmatching stack kinds (" + condition + "): " +
Expand Down
Expand Up @@ -1498,6 +1498,7 @@ private ConditionFlag convertCondition(Condition condition) {
}

@Override
@SuppressWarnings("fallthrough")
protected void emitCompare(Condition condition, CiValue opr1, CiValue opr2, LIROp2 op) {
// Checkstyle: off
assert Util.archKindsEqual(opr1.kind.stackKind(), opr2.kind.stackKind()) || (opr1.kind == CiKind.Long && opr2.kind == CiKind.Int) : "nonmatching stack kinds (" + condition + "): " +
Expand Down
2 changes: 2 additions & 0 deletions com.sun.cri/src/com/sun/cri/ci/CiUtil.java
Expand Up @@ -270,6 +270,7 @@ public static String format(String format, RiField field, boolean arg) throws Il
* @return the result of formatting this method according to {@code format}
* @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
*/
@SuppressWarnings("fallthrough")
public static String format(String format, RiMethod method) throws IllegalFormatException {
final StringBuilder sb = new StringBuilder();
int index = 0;
Expand Down Expand Up @@ -360,6 +361,7 @@ public static String format(String format, RiMethod method) throws IllegalFormat
* @return the result of formatting this field according to {@code format}
* @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
*/
@SuppressWarnings("fallthrough")
public static String format(String format, RiField field) throws IllegalFormatException {
final StringBuilder sb = new StringBuilder();
int index = 0;
Expand Down
Expand Up @@ -169,6 +169,7 @@ private X86InstructionHeader scanInstructionHeader(BufferedInputStream stream, b
return justSkip ? null : header;
}

@SuppressWarnings("fallthrough")
private List<Argument> scanArguments(BufferedInputStream stream, X86Template template, X86InstructionHeader header, byte modRMByte, byte sibByte) throws IOException {
final List<Argument> arguments = new ArrayList<Argument>();
final byte rexByte = (header.rexPrefix != null) ? header.rexPrefix.byteValue() : 0;
Expand Down
Expand Up @@ -273,6 +273,7 @@ public void visitAddressingMethodCode(AddressingMethodCode addressingMethodCode,
}
}

@SuppressWarnings("fallthrough")
private String getOperandTypeSuffix(OperandTypeCode operandTypeCode) throws TemplateNotNeededException {
switch (operandTypeCode) {
case b:
Expand All @@ -281,9 +282,9 @@ private String getOperandTypeSuffix(OperandTypeCode operandTypeCode) throws Temp
if (operandSizeAttribute() != addressSizeAttribute()) {
throw TemplateNotNeededException.raise();
}
// Checkstyle: stop
// fall through
case d_q:
// Checkstyle: resume
// fall through
case v:
switch (operandSizeAttribute()) {
case BITS_16:
Expand Down
Expand Up @@ -130,6 +130,7 @@ private boolean sibRequiresImmediate(int sibRMByte) {
return X86Field.BASE.extract(s) == 5;
}

@SuppressWarnings("fallthrough")
public byte[] assemble(List<Argument> arguments) {
int rexByte = 0;
final boolean unconditionalRexBit = template.operandSizeAttribute() == WordWidth.BITS_64 && template.instructionDescription().defaultOperandSize() != WordWidth.BITS_64;
Expand Down
1 change: 1 addition & 0 deletions com.sun.max/src/com/sun/max/vm/actor/Actor.java
Expand Up @@ -596,6 +596,7 @@ private static void appendFlag(StringBuilder sb, boolean flag, String string) {
* @return the result of formatting this method according to {@code format}
* @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
*/
@SuppressWarnings("fallthrough")
public final String format(boolean strict, String format, Object... args) throws IllegalFormatException {
final StringBuilder sb = new StringBuilder();
int index = 0;
Expand Down
Expand Up @@ -407,14 +407,19 @@ public static void unroll(Info info) {
switch (info.returnValue.kind.stackKind()) {
case Int:
Stubs.unwindInt(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asInt());
break;
case Float:
Stubs.unwindFloat(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asFloat());
break;
case Long:
Stubs.unwindLong(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asLong());
break;
case Double:
Stubs.unwindDouble(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asDouble());
break;
case Object:
Stubs.unwindObject(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asObject());
break;
default:
FatalError.unexpected("unexpected return kind: " + info.returnValue.kind.stackKind());
}
Expand Down
4 changes: 2 additions & 2 deletions mx.maxine/suite.py
Expand Up @@ -28,7 +28,7 @@
"write": "git@github.com:beehive-lab/Maxine-VM.git",
},
"outputRoot": "./",
"javac.lint.overrides": "-rawtypes,-serial,-fallthrough",
"javac.lint.overrides": "-rawtypes,-serial",

"imports": {
"suites": [
Expand Down Expand Up @@ -286,7 +286,7 @@
"checkstyle": "com.sun.max",
"TestProject": True,
"javaCompliance": "1.8",
"javac.lint.overrides": "-rawtypes,-serial,-fallthrough,-finally",
"javac.lint.overrides": "-rawtypes,-serial,-finally",
},

"com.oracle.max.vma.tools": {
Expand Down

0 comments on commit 72cda5d

Please sign in to comment.