[Skiboot] [PATCH] tests: Squash __attrconst related warnings

Oliver O'Halloran oohall at gmail.com
Wed Nov 13 20:42:57 AEDT 2019

On Wed, Nov 13, 2019 at 5:30 PM Oliver O'Halloran <oohall at gmail.com> wrote:
> Currently we get a warning because in some of the test stub functions:
>         [ HOSTCC ]  hw/test/phys-map-test.c
> In file included from hw/test/phys-map-test.c:8:
> hw/test/../../core/test/stubs.c:78:1: warning: ‘const’ attribute on
> function returning ‘void’ [-Wattributes]
>    78 | {
>       | ^
> I'm pretty sure we added that __attrconst to squash a warning with an
> earlier GCC, then they went an added a warning for the "fix." I love
> compilers.

And if you build on 16.04 with this patch applied:

core/test/stubs.c: In function 'cpu_wait_job':
core/test/stubs.c:70:6: error: function might be candidate for
attribute 'const' [-Werror=suggest-attribute=const]
 void cpu_wait_job(struct cpu_job *job, bool free_it)
core/test/stubs.c: In function 'cpu_process_local_jobs':
core/test/stubs.c:77:6: error: function might be candidate for
attribute 'const' [-Werror=suggest-attribute=const]
 void cpu_process_local_jobs(void)
cc1: all warnings being treated as errors
/build/core/test/Makefile.check:61: recipe for target 'core/test/stubs.o' failed
make: *** [core/test/stubs.o] Error 1

Great stuff!

More information about the Skiboot mailing list