lwIP - A Lightweight TCP/IP stack - Patches: patch #5846, struct sockaddr_in has different...
You are not allowed to post comments on this tracker with your current authentication level.
patch #5846: struct sockaddr_in has different alignment than struct sockaddr
Submitter: | Simon Goldschmidt <goldsimon> | ||
Submitted: | Mon 02 Apr 2007 08:32:36 PM UTC | ||
Category: | None | Priority: | 3 - Low |
Status: | Wont Do | Privacy: | Public |
Assigned to: | goldsimon | Open/Closed: | Closed |
Planned Release: | None |
Jump to the original submission
Wed 11 Apr 2007 07:00:06 PM UTC, comment #8: |
Simon Goldschmidt <goldsimon> |
Sat 07 Apr 2007 08:20:09 PM UTC, comment #7: The reason I was concerned about unnecessary overhead (extra code and/or extra footprint) was because you had said earlier in the comment to which I replied: "In other words, I think if the one is packed, the other should be packed, also."
|
Jonathan Larmour <jifl> |
Sat 07 Apr 2007 09:10:17 AM UTC, comment #6: OK, I can understand it's not a nice solution I brought up. What I can't understand is why aligning the struct sockaddr would slow down lwIP. It's just used for pointers anyway, its members are never accessed. Pushing around an aligned pointer is not different from an unaligned, is it?
|
Simon Goldschmidt <goldsimon> |
Sat 07 Apr 2007 03:26:23 AM UTC, comment #5: So you're building with -Wcast-align. That's your problem. lwIP is doing nothing wrong at all, and I would be against slowing done lwIP to pacify some warning about something that isn't a problem.
|
Jonathan Larmour <jifl> |
Fri 06 Apr 2007 11:01:06 AM UTC, comment #4: Example of code that causes the warning:
|
Simon Goldschmidt <goldsimon> |
Thu 05 Apr 2007 01:30:34 PM UTC, comment #3: This doesn't seem right. No-one should be declaring a "struct sockaddr". This means that we only ever declare sockaddr_in's, and cast them to sockaddr's, and that means the alignment is always fine.
|
Jonathan Larmour <jifl> |
Tue 03 Apr 2007 01:48:16 PM UTC, comment #2: It's the whole struct which is unaligned. Casting a pointer from sockaddr_in to sockaddr leads to a warning. In Linux, it's the way we have it, but in my opinion, this would also lead to a warning, wouldn't it?
|
Simon Goldschmidt <goldsimon> |
Tue 03 Apr 2007 01:42:19 PM UTC, comment #1: Is the problem the layout of the fields within the structure, or how an instance of the structure itself is aligned?
|
Kieran Mansley <kieranm> |
Mon 02 Apr 2007 08:32:36 PM UTC, original submission:
Because struct sockaddr only includes u8_t values, it is byte-aligned, while struct sockaddr_in is 4-byte-aligned (because of in_addr).
|
Simon Goldschmidt <goldsimon> |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 3 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2007-04-11 | goldsimon | Status | In Progress | Wont Do | |
Open/Closed | Open | Closed | |||
2007-04-02 | goldsimon | Attached File | - | Added sockets_alignment.patch, #12381 |
Powered by Savane 3.13-caa5.
Corresponding source code
OK, you convinced me not to use -Wcast-align on lwIP.
Closing this as 'Wont Do'.