This fixes -Wcast-align warnings caused by the underaligned struct ip.
This also silences them in the public functions by changing the function
signature from char * to void *. This is source and binary compatible and
avoids the -Wcast-align warning.
Details
Details
- Reviewers
emaste ae glebius - Group Reviewers
manpages - Commits
- rG41301f352de6: libalias: Fix -Wcast-align compiler warnings
rGbc596e563245: libalias: Fix -Wcast-align compiler warnings
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/netinet/libalias/alias.c | ||
---|---|---|
1215 | The problem here is that struct ip is declared as packed, so taking a pointer to one of the uint32 members can break on architectures that don't allow unaligned stores. This was introduced in 8018ac153f7671699ca008f31c0fad9caef2f531 and causes architectures such as RISC-V to always use two 16-bit loads+shifts to read struct in_addr. |
Comment Actions
If you tested the change and it works for you, I have no objection.
sys/netinet/libalias/alias.c | ||
---|---|---|
1260 | I think we usually don't use such syntax with tabs. |
sys/netinet/libalias/alias.c | ||
---|---|---|
1260 | Good point. I'm touching the line anyway so I might as well fix style issues at the same time. |