comparison cmd.c @ 30:2552eec9b913

Explicitly handle all cases in switch statements
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Tue, 28 Nov 2017 15:09:19 +0100
parents e3db02d7f1f4
children 9be355e742e5
comparison
equal deleted inserted replaced
29:00d782cb45fa 30:2552eec9b913
306 pwm_err(ctx, "trailing backslash in macro"); 306 pwm_err(ctx, "trailing backslash in macro");
307 goto out; 307 goto out;
308 case TOK_ERR_INVALID_MACRO_NAME: 308 case TOK_ERR_INVALID_MACRO_NAME:
309 pwm_err(ctx, "invalid macro name referenced in macro"); 309 pwm_err(ctx, "invalid macro name referenced in macro");
310 goto out; 310 goto out;
311 case TOK_ERR_OK:
312 break;
311 } 313 }
312 314
313 /* parse macro definition */ 315 /* parse macro definition */
314 switch (macro_parse(name, tokenc, tokenv, ctx->macro_head, 316 switch (macro_parse(name, tokenc, tokenv, ctx->macro_head,
315 &macro_entry)) { 317 &macro_entry)) {
320 pwm_err(ctx, "macro definition references undefined macro"); 322 pwm_err(ctx, "macro definition references undefined macro");
321 goto out; 323 goto out;
322 case MACRO_ERR_RECURSIVE: 324 case MACRO_ERR_RECURSIVE:
323 pwm_err(ctx, "macro definition must not be recursive"); 325 pwm_err(ctx, "macro definition must not be recursive");
324 goto out; 326 goto out;
327 case MACRO_ERR_OK:
328 break;
325 } 329 }
326 330
327 macro_add(ctx->macro_head, macro_entry); 331 macro_add(ctx->macro_head, macro_entry);
328 retval = CMD_OK; 332 retval = CMD_OK;
329 333
563 case IO_SIGNAL: 567 case IO_SIGNAL:
564 return (CMD_SIGNAL); 568 return (CMD_SIGNAL);
565 case IO_PASSWORD_MISMATCH: 569 case IO_PASSWORD_MISMATCH:
566 pwm_err(ctx, "passwords do not match"); 570 pwm_err(ctx, "passwords do not match");
567 continue; 571 continue;
572 default:
573 break;
568 } 574 }
569 } 575 }
570 576
571 password_done: 577 password_done:
572 if (io_get_line(NULL, "Notes: ", 0, record->notes, -1, 578 if (io_get_line(NULL, "Notes: ", 0, record->notes, -1,