Thu 20 Jul 2017 08:23:55 PM UTC, comment #10:
Great! Thanks for quick turn-around :)
|
Thu 20 Jul 2017 08:12:41 PM UTC, comment #9:
Yes. I've just pushed it :-)
|
Mon 17 Jul 2017 07:34:31 PM UTC, comment #8:
compat folder sounds like a good idea to me:
So you're thinking:
lwip/src/include/compat/posix/...
lwip/src/include/compat/stdc/errno.h?
|
Mon 17 Jul 2017 07:01:38 PM UTC, comment #7:
OK, all the other files seem net-related.
Is it worth moving the existing files for clarity and to prevent having even more directories under "src/include"? In that case, I'd rather create a folder "compat" to clearly mark the beginning of compatibility-only header files and from there branch to subfolders...
|
Mon 17 Jul 2017 03:57:31 PM UTC, comment #6:
> Seems like errno.h would need a different directory then?
That's what I was thinking too. What about the following organization:
lwip/src/include/posix/... (contains the POSIX networking headers)
lwip/src/include/stdc/errno.h (contains ISO standard C headers)
Or we could introduce a 'clib' folder for c library headers, under which you'd have both a posix and stdc:
lwip/src/include/clib/posix/...
lwip/src/include/clib/stdc/errno.h
This link (https://en.wikipedia.org/wiki/C_POSIX_library) was helpful in understanding the relationship of the POSIX C library to ISO standard C (POSIX is a superset).
|
Sun 16 Jul 2017 06:09:31 PM UTC, comment #5:
No, I guess not. Seems like errno.h would need a different directory then?
|
Fri 14 Jul 2017 06:29:21 PM UTC, comment #4:
> In other words, having both LWIP_ERRNO_STDINCLUDE==1 and the "include/posix" in your include paths is not meant to work (yet?) ;-)
Thinking about this more, the posix/errno.h with LWIP_PROVIDE_ERRNO == 1 is only safe if the C library doesn't also provide errno.h because other source files in the project may be compiled against the standard C library version (depending on include paths during compilation) and you'll end up with a binary incompatibility between object files if underlying values don't match.
Have you worked with embedded toolchains where errno.h is not provided by the standard C library? I typically use the ARM C Compiler and GCC ARM Embedded, both provide errno.h, but none of the BSD socket (later standardized to POSIX) headers.
|
Fri 14 Jul 2017 05:48:53 PM UTC, comment #3:
In other words, having both LWIP_ERRNO_STDINCLUDE==1 and the "include/posix" in your include paths is not meant to work (yet?) ;-)
|
Fri 14 Jul 2017 05:47:56 PM UTC, comment #2:
Well, the whole purpose of the 'posix' subtree is to provide standard definitions for those header files if wanted (i.e. if they don't exist otherwise).
Now you seem to want other standard files but not errno.h. That might be a valid thing to do, but I don't see how we could achieve that other than creating a separate include directory for all of those files?
|
Fri 14 Jul 2017 02:35:09 PM UTC, comment #1:
I enabled some include tree debugging and found another broken case:
application code (#include "lwip/socket.h") -> lwip/errno.h -> posix/errno.h -> lwip/errno.h -> nop
Since I'm using LWIP_ERRNO_STDINCLUDE, lwip/errno.h should be picking up stdclib errno.h. See attachment for full include tree
In comment #1, I had described the following case:
application code (include <errno.h>) -> posix/errno.h -> lwip/errno.h -> posix/errno.h -> lwip/errno.h -> nop
(file #41204)
|
Fri 14 Jul 2017 12:17:03 AM UTC, original submission:
In my port, I'm trying to make use of the posix compatibility headers and have LWIP_ERRNO_STDINCLUDE set to 1. In my project, the standard C library errno.h is the canonical one.
posix/errno.h is creating a problem because once in the build system, files are picking it up and then it includes lwip/errno.h, which is empty because LWIP_ERRNO_STDINCLUDE is trying to include the standard C library errno.h, but gets posix/errno.h (lwip/errno.h does not get included again due to #ifndef LWIP_HDR_ERRNO_H).
I've confirmed this by deleting posix/errno.h and things work as expected, with the standard C library errno.h now satisfying the dependency
Was the motivation behind the posix/errno.h addition to allow LwIP to provide a canonical errno.h for the entire project (LwIP sources + other files)? I like this idea, but would prefer it be separate from the posix headers (my build system can't blacklist a single header). Also, errno.h is part of the standard C library, would it make more sense as include/stdclib/errno.h?
Thanks
|