diff options
author | olivier gayot <ogayot@free.fr> | 2012-12-12 22:27:14 +0000 |
---|---|---|
committer | olivier gayot <ogayot@free.fr> | 2012-12-12 22:27:14 +0000 |
commit | 88ba8ead742537c369c228953a2b2a88efd021f5 (patch) | |
tree | 6a3d74e3311235678dedb3315292d8ba9b839bce | |
parent | a68838f0f6873979e3dcb2c8c8b8ef10017fefc3 (diff) |
le_compte_est_bon: fix - warning when compiling with -O3
The switch - case seems to need always a default case. Otherwise, it
produces a warning when compiling with optimization.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | solver.c | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -Wall -W -Wextra -std=c99 -g +CFLAGS = -Wall -W -Wextra -std=c99 -O3 NAME = solver $(NAME): .solver.o .main.o @@ -3,6 +3,7 @@ #include <malloc.h> #include <limits.h> #include <stdint.h> +#include <assert.h> #include "solver.h" #define _log(...) fprintf(stderr, __VA_ARGS__) @@ -39,6 +40,7 @@ static void display_solution(void) { puts("--------------------------"); puts("found a (better) solution:"); + for (int i = 5; i >= solution_g.level; i--) { char op; int _result; @@ -60,6 +62,9 @@ static void display_solution(void) op = '/'; _result = solution_g.computation[i].v1 / solution_g.computation[i].v2; break; + default: + assert (0); + break; } printf("%d %c %d = %d\n", solution_g.computation[i].v1 |