1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

style: switch statements indent

Case labels get half an indent and the opening brace is on the same line
as "switch".
This commit is contained in:
Alan Wu 2021-09-29 15:38:57 -04:00
parent a10cf74e5c
commit ec4998bd69
3 changed files with 160 additions and 172 deletions

View file

@ -335,8 +335,7 @@ void cb_write_int(codeblock_t *cb, uint64_t val, uint32_t num_bits)
assert (num_bits % 8 == 0);
// Switch on the number of bits
switch (num_bits)
{
switch (num_bits) {
case 8:
cb_write_byte(cb, (uint8_t)val);
break;
@ -1439,8 +1438,7 @@ void neg(codeblock_t *cb, x86opnd_t opnd)
// nop - Noop, one or multiple bytes long
void nop(codeblock_t *cb, uint32_t length)
{
switch (length)
{
switch (length) {
case 0:
break;

View file

@ -1397,8 +1397,7 @@ guard_self_is_heap(codeblock_t *cb, x86opnd_t self_opnd, uint8_t *side_exit, ctx
static void
gen_jnz_to_target0(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
case SHAPE_NEXT1:
RUBY_ASSERT(false);
@ -1413,8 +1412,7 @@ gen_jnz_to_target0(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t
static void
gen_jz_to_target0(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
case SHAPE_NEXT1:
RUBY_ASSERT(false);
@ -1429,8 +1427,7 @@ gen_jz_to_target0(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t s
static void
gen_jbe_to_target0(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
case SHAPE_NEXT1:
RUBY_ASSERT(false);
@ -2598,8 +2595,7 @@ gen_opt_case_dispatch(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb)
void
gen_branchif_branch(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
jz_ptr(cb, target1);
break;
@ -2655,8 +2651,7 @@ gen_branchif(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb)
void
gen_branchunless_branch(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
jnz_ptr(cb, target1);
break;
@ -2712,8 +2707,7 @@ gen_branchunless(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb)
void
gen_branchnil_branch(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
jne_ptr(cb, target1);
break;
@ -3303,8 +3297,7 @@ gen_send_cfunc(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const
static void
gen_return_branch(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
case SHAPE_NEXT1:
RUBY_ASSERT(false);

View file

@ -144,8 +144,7 @@ ctx_get_opnd_type(const ctx_t *ctx, insn_opnd_t opnd)
temp_mapping_t mapping = ctx->temp_mapping[stack_idx];
switch (mapping.kind)
{
switch (mapping.kind) {
case TEMP_SELF:
return ctx->self_type;
@ -188,8 +187,7 @@ void ctx_upgrade_opnd_type(ctx_t *ctx, insn_opnd_t opnd, val_type_t type)
temp_mapping_t mapping = ctx->temp_mapping[stack_idx];
switch (mapping.kind)
{
switch (mapping.kind) {
case TEMP_SELF:
UPGRADE_TYPE(ctx->self_type, type);
break;
@ -901,8 +899,7 @@ void gen_branch(
void
gen_jump_branch(codeblock_t *cb, uint8_t *target0, uint8_t *target1, uint8_t shape)
{
switch (shape)
{
switch (shape) {
case SHAPE_NEXT0:
break;