cyring / CoreFreq

CoreFreq : CPU monitoring and tuning software designed for 64-bit processors.
https://www.cyring.fr
GNU General Public License v2.0
1.94k stars 127 forks source link

Build failure on openSUSE 15.4 #419

Closed bubbleguuum closed 1 year ago

bubbleguuum commented 1 year ago

Building CoreFreq for openSUSE 15.4 on OBS (Open Build Service) fails on a label at end of compound statement warning turned into error due to -Wfatal-errors being used:

[   45s]   CC [M]  /home/abuild/rpmbuild/BUILD/CoreFreq-1.95.4/corefreqk.o
[   46s] /home/abuild/rpmbuild/BUILD/CoreFreq-1.95.4/corefreqk.c: In function 'Query_TGL_IMC':
[   46s] /home/abuild/rpmbuild/BUILD/CoreFreq-1.95.4/corefreqk.c:5197:1: error: label at end of compound statement
[   46s]  EXIT_TGL_IMC:
[   46s] compilation terminated due to -Wfatal-errors.

On openSUSE Tumbleweed there is no such issue. Tumbleweed uses gcc 12 while I think 15.4 uses gcc 7 to compile modules

Googling this warning it seems to be caused by a switch without a default label or a default label without a break.

Full build log

cyring commented 1 year ago

You should be right; this time I did not make regression tests on oldest kernel and gcc. I will fix that ASAP when I'm back to labs. Thank you.

cyring commented 1 year ago

Not switch but a lonely label at the end of those two void functions.

An empty statement should help compiler:

void Query_TGL_IMC(void __iomem *mchmap, unsigned short mc)
{
EXIT_TGL_IMC: do { } while (0);
}
void Query_ADL_IMC(void __iomem *mchmap, unsigned short mc)
{
EXIT_ADL_IMC: do { } while (0);
}
bubbleguuum commented 1 year ago

Thanks, confirming it fixes the compile error.

cyring commented 1 year ago

Fix available in commit 453b8b9db471ff1b631ceb3e61cf14942506bba5

olejon commented 1 year ago

Confirmed fixed on Ubuntu 20.04.5 LTS. Stopped compiling with exit 1 error for dkms install corefreqk/1.95 - not dkms add corefreqk/1.95 first of course - but 1 second into make - on v 1.95.3 and also 1.95.4, so I reverted to 1.95.2 (was stable and reliable as always).

I assumed this was reported and so I didn't report it. Didn't bother you check the dkms error log, so 💤

Sorry. I should have when 2 consecutive releases failed.

Now it's fixed 👍🏻