Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] checkapi

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Mon, 11 Apr 2016 10:29:51 -0400


On Sun, Apr 10, 2016 at 4:44 PM, Graham Bloice <graham.bloice@xxxxxxxxxxxxx> wrote:
After creating an initial change to add checkAPI to CMake builds, following the current checks done by nmake, I got the attached (massaged) output.

While there are some warnings to be fixed up, I'm more interested in the errors as they'll make a build as bad until fixed.  Are these errors ones that should be fixed, or should the offending files be excluded from checkAPI.

CUSTOMBUILD : error : Found prohibited APIs in C:/buildbot/builders/windows-x86-petri-dish/windows-x86-petri-dish/build/cmbuild/epan/dfilter/scanner.c: malloc,realloc,free [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\dfilter\checkAPI_dfilter.vcxproj]

Historically we haven't run checkAPIs on generated code.  We're trying to keep our developers honest, not Flex et al. :-)  Taking the generated code out reduces the list of errors significantly.
 
CUSTOMBUILD : error : Found prohibited APIs in app_mem_usage.c: open [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\checkAPI_epan.vcxproj]

The 'open()' call is Linux-only so technically it's not a problem (according to the comments in checkApi we prohibit 'open' because of Windows).  Then again just replacing it with ws_open() is easy enough.
 
CUSTOMBUILD : error : Found prohibited APIs in guid-utils.c: _snwprintf [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\checkAPI_epan.vcxproj]

Gerald (in r43756) said this should be StringCchPrintf().  Not sure why.
 
CUSTOMBUILD : error : Found prohibited APIs in ftype-guid.c: strncpy [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\ftypes\checkAPI_ftypes.vcxproj]
CUSTOMBUILD : error : Found prohibited APIs in ftype-pcre.c: strcpy [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\ftypes\checkAPI_ftypes.vcxproj]
CUSTOMBUILD : error : Found prohibited APIs in ftype-string.c: strcpy [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\ftypes\checkAPI_ftypes.vcxproj]
CUSTOMBUILD : error : Found prohibited APIs in ftype-time.c: strcpy [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\epan\ftypes\checkAPI_ftypes.vcxproj]

Looks like these have snuck in while the buildbots weren't running checkapi; checkapis run from autotools also complains.
 
CUSTOMBUILD : error : Found prohibited APIs in getopt_long.c: malloc,free [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\wsutil\checkAPI_wsutil.vcxproj]

Technically this isn't our code; I'd say skipping it would be appropriate.
 
CUSTOMBUILD : error : Found prohibited APIs in inet_aton.c: htonl,isascii,isdigit,islower,isspace,isxdigit [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\wsutil\checkAPI_wsutil.vcxproj]
CUSTOMBUILD : error : Found prohibited APIs in strptime.c: isspace,strncasecmp [C:\buildbot\builders\windows-x86-petri-dish\windows-x86-petri-dish\build\cmbuild\wsutil\checkAPI_wsutil.vcxproj]

Looks like bugs to me (based on our passed locale problems).