projects/pwm

changeset 30:2552eec9b913

Explicitly handle all cases in switch statements
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Tue Nov 28 15:09:19 2017 +0100 (2017-11-28)
parents 00d782cb45fa
children 9be355e742e5
files cmd.c pwm.c pwmrc.c
line diff
     1.1 --- a/cmd.c	Thu Sep 28 10:06:59 2017 +0200
     1.2 +++ b/cmd.c	Tue Nov 28 15:09:19 2017 +0100
     1.3 @@ -308,6 +308,8 @@
     1.4  	case TOK_ERR_INVALID_MACRO_NAME:
     1.5  		pwm_err(ctx, "invalid macro name referenced in macro");
     1.6  		goto out;
     1.7 +	case TOK_ERR_OK:
     1.8 +		break;
     1.9  	}
    1.10  
    1.11  	/* parse macro definition */
    1.12 @@ -322,6 +324,8 @@
    1.13  	case MACRO_ERR_RECURSIVE:
    1.14  		pwm_err(ctx, "macro definition must not be recursive");
    1.15  		goto out;
    1.16 +	case MACRO_ERR_OK:
    1.17 +		break;
    1.18  	}
    1.19  
    1.20  	macro_add(ctx->macro_head, macro_entry);
    1.21 @@ -565,6 +569,8 @@
    1.22  		case IO_PASSWORD_MISMATCH:
    1.23  			pwm_err(ctx, "passwords do not match");
    1.24  			continue;
    1.25 +		default:
    1.26 +			break;
    1.27  		}
    1.28  	}
    1.29  
     2.1 --- a/pwm.c	Thu Sep 28 10:06:59 2017 +0200
     2.2 +++ b/pwm.c	Tue Nov 28 15:09:19 2017 +0100
     2.3 @@ -182,6 +182,8 @@
     2.4  				goto out;
     2.5  			}
     2.6  			goto next;
     2.7 +		case TOK_ERR_OK:
     2.8 +			break;
     2.9  		}
    2.10  
    2.11  		/* expand macros */
    2.12 @@ -224,6 +226,8 @@
    2.13  			fprintf(stderr, "received signal, quitting\n");
    2.14  		case CMD_QUIT:	/* FALLTHROUGH */
    2.15  			goto quit;
    2.16 +		default:
    2.17 +			break;
    2.18  		}
    2.19  		ctx->prev_cmd = cmd->full_cmd;
    2.20  
     3.1 --- a/pwmrc.c	Thu Sep 28 10:06:59 2017 +0200
     3.2 +++ b/pwmrc.c	Tue Nov 28 15:09:19 2017 +0100
     3.3 @@ -115,6 +115,8 @@
     3.4  				goto out;
     3.5  			}
     3.6  			goto next;
     3.7 +		case TOK_ERR_OK:
     3.8 +			break;
     3.9  		}
    3.10  
    3.11  		/* expand macros */