This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add missing headers to fix implicit function defns


Am 17.01.2017 um 11:08 schrieb Sebastian Huber:
On 16/01/17 22:21, Hans-Bernhard Bröker wrote:
Am 16.01.2017 um 01:12 schrieb Pat Pannuto:

If a header defines macros which reference things provided by other
headers, it should make sure those other things are known, i.e. it
should include those other headers.

No, this would lead to cyclic dependencies (<stdlib.h> includes
<sys/reent.h>) and would make <string.h> and <stdlib.h> unnecessarily
visible via unrelated standard header files.

Indeed. I had found that out, too, in the meantime, but forgot to CC: the list in the reply.

But that does mean there's already a cyclic header dependency now, introduced by <sys/reent.h> referencing to stuff from <string.h>, while <string.h> includes <sys/reent.h> (smae for <stdlib.h>). That should really be avoided, if at all possible. Usually, this would mean that the actual declarations/definitions of malloc() and memset() should be in separate header fragments, to be included by both <sys/reent.h> and <stdlib.h>/<string.h>, respectively.

Could this mean that many of the 274 occurences of #include <reent.h> in the *.c files could actually be dropped, since what those sources really need out of it is already provided indirectly by their includes of <stdio.h>, <string.h>, etc.? In a small experimen the 4 files modified by this patch, and the Cygwin build of newlib, removing their #include <reent.h> didn't appear to break the build...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]