Bug 1294 - includes.h should pull in string.h based on HAVE_STRING_H
Summary: includes.h should pull in string.h based on HAVE_STRING_H
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 4.6p1
Hardware: Other Linux
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_4_6_P2
  Show dependency treegraph
 
Reported: 2007-03-12 06:21 AEDT by Mike Frysinger
Modified: 2008-04-04 09:58 AEDT (History)
1 user (show)

See Also:


Attachments
openssh-4.6_p1-include-string-header.patch (238 bytes, text/plain)
2007-03-12 06:22 AEDT, Mike Frysinger
no flags Details
Include string.h from *.c files (1.84 KB, patch)
2007-03-12 10:25 AEDT, Darren Tucker
djm: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2007-03-12 06:21:11 AEDT
there's some logic in includes.h to handle HAVE_STRINGS_H, but none for HAVE_STRING_H

the reason for this is that many source files use str* and mem* functions but are inconsistent as to whether they include string.h ...

for example, these files do not include string.h, yet they use funcs:
entropy.c
scard-opensc.c
ssh-rand-helper.c

in the case of scard-opensc.c, it results in ugly warnings like:
scard-opensc.c: In function 'sc_prkey_op_init':
scard-opensc.c:176: warning: implicit declaration of function 'strcmp'
scard-opensc.c:188: warning: implicit declaration of function 'strlen'
scard-opensc.c:188: warning: incompatible implicit declaration of built-in function 'strlen'
scard-opensc.c:198: warning: implicit declaration of function 'memset'
scard-opensc.c:198: warning: incompatible implicit declaration of built-in function 'memset'
scard-opensc.c:204: warning: incompatible implicit declaration of built-in function 'memset'
Comment 1 Mike Frysinger 2007-03-12 06:22:00 AEDT
Created attachment 1247 [details]
openssh-4.6_p1-include-string-header.patch

this applies against both 4.6_p1 and current portable cvs
Comment 2 Darren Tucker 2007-03-12 10:25:21 AEDT
Created attachment 1248 [details]
Include string.h from *.c files

The intent is that the standard headers get included directly from the .c files where possible.

The attached patch does that for the files you mentioned, are there any others?  Thanks.
Comment 3 Mike Frysinger 2007-03-12 17:48:46 AEDT
*shrug* i was just grepping for common mem/str funcs and found those three files ...
Comment 4 Darren Tucker 2007-05-20 15:33:41 AEST
Patch #1248 was committed a while back and will be in the next major release (4.7).  Thanks for the report.
Comment 5 Damien Miller 2008-04-04 09:58:46 AEDT
Close resolved bugs after release.