Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Wconst-qual warnings #11

Open
pattop opened this issue Jun 4, 2020 · 0 comments
Open

Fix -Wconst-qual warnings #11

pattop opened this issue Jun 4, 2020 · 0 comments

Comments

@pattop
Copy link
Member

pattop commented Jun 4, 2020

gcc correctly warns about a couple of dodgy casts when building Apex with -Wcast-qual.

In file included from /home/patrick/src/motec/adr2/apex/sys/include/arch.h:39,
                 from /home/patrick/src/motec/adr2/apex/sys/kern/syslog.c:8:
/home/patrick/src/motec/adr2/apex/sys/kern/syslog.c: In function 'syslog_output':
/home/patrick/src/motec/adr2/apex/sys/include/compiler.h:108:4: warning: to be safe all intermediate pointers in cast from 'void (**)(void)' to 'void (* volatile*)(void)' must be 'const' qualified [-Wcast-qual]
  108 |   *(volatile typeof(*(p)) *)(p) = v; \
      |    ^
/home/patrick/src/motec/adr2/apex/sys/kern/syslog.c:276:2: note: in expansion of macro 'write_once'
  276 |  write_once(&log_output, fn);
      |  ^~~~~~~~~~
/home/patrick/src/motec/adr2/apex/sys/arch/arm/v7m/context.c: In function 'fpu_load':
/home/patrick/src/motec/adr2/apex/sys/arch/arm/v7m/context.c:329:12: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
  329 |   : : "m"(*(const uint32_t(*)[16])(f->regs + 16)), "r"(f->regs + 16));
      |            ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant