cyring / CoreFreq

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

clang compile issues #281

Closed thor2002ro closed 2 years ago

thor2002ro commented 2 years ago

the register here is an issue

https://github.com/cyring/CoreFreq/blob/8d4ec519a8fcc565c2c4e7440e337ea4bce6e365/corefreq-cli.c#L16545

corefreq-cli.c:16550:23: fatal error: address of register variable requested LayerAt(layer, attr, col[1] , row) = eventAttr[_hot][0];

From Wikipedia:

In C (but not C++ where the keyword is essentially ignored) the location of a variable declared with register cannot be accessed, but the sizeof operator can be applied. Aside from this limitation, register is essentially meaningless in modern compilers due to optimization which will place variables in a register if appropriate regardless of whether the hint is given.

cyring commented 2 years ago

the register here is an issue

https://github.com/cyring/CoreFreq/blob/8d4ec519a8fcc565c2c4e7440e337ea4bce6e365/corefreq-cli.c#L16545

corefreq-cli.c:16550:23: fatal error: address of register variable requested LayerAt(layer, attr, col[1] , row) = eventAttr[_hot][0];

From Wikipedia:

In C (but not C++ where the keyword is essentially ignored) the location of a variable declared with register cannot be accessed, but the sizeof operator can be applied. Aside from this limitation, register is essentially meaningless in modern compilers due to optimization which will place variables in a register if appropriate regardless of whether the hint is given.

I do agree. Will remove that in next commit.

thor2002ro commented 2 years ago

thanks :)

cyring commented 2 years ago

Hello, Code fix is available in develop branch.