Error in sap.c
bvanpoortvliet opened this issue · 2 comments
This is my first time filing an issue, so please be mercyful :).
When trying to compile on Linux ubuntu 4.18.0-17-generic #18~18.04.1-Ubuntu I got the following error:
sap.c: In function ‘sap’:
sap.c:41:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 4000: ptime = (mai.args.rate == 44100) ? "4.35" : "4";
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sap.c:42:3: note: here
case 1000: ptime = (mai.args.rate == 44100) ? "1.09" : "1";
^~~~
sap.c:42:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 1000: ptime = (mai.args.rate == 44100) ? "1.09" : "1";
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sap.c:43:3: note: here
case 333: ptime = (mai.args.rate == 44100) ? "0.36" : "0.33";
^~~~
sap.c:43:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 333: ptime = (mai.args.rate == 44100) ? "0.36" : "0.33";
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sap.c:44:3: note: here
case 250: ptime = (mai.args.rate == 44100) ? "0.27" : "0.25";
^~~~
sap.c:44:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 250: ptime = (mai.args.rate == 44100) ? "0.27" : "0.25";
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sap.c:45:3: note: here
case 125: ptime = (mai.args.rate == 44100) ? "0.13" : "0.12";
^~~~
cc1: all warnings being treated as errors
: recipe for target 'sap.o' failed
make: *** [sap.o] Error 1
I got it to compile by adding brake statements like below:
switch (mai.args.ptime) {
case 4000: ptime = (mai.args.rate == 44100) ? "4.35" : "4"; break;
case 1000: ptime = (mai.args.rate == 44100) ? "1.09" : "1"; break;
case 333: ptime = (mai.args.rate == 44100) ? "0.36" : "0.33"; break;
case 250: ptime = (mai.args.rate == 44100) ? "0.27" : "0.25"; break;
case 125: ptime = (mai.args.rate == 44100) ? "0.13" : "0.12";
I hope this was helpful.
FWIW, looks like someone forked the repo a while back and fixed this by adding the suggested lines to the makefile. Their change is listed here: https://github.com/OneB1t/mai/commit/94f29d5213fb95d87e9c74c44fe3cd8a98c8e1d7
Fixed actual errors, rather than simply silencing the warning as suggested above, in 0d4c4fd.