Opened 8 months ago

Closed 8 months ago

#68154 closed defect (fixed)

opensc @0.23.0: error: implicit declaration of function 'strnlen' is invalid in C99

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: snowleopard Cc:
Port: opensc

Description

https://build.macports.org/builders/ports-10.6_x86_64-builder/builds/170734/steps/install-port/logs/stdio

openpgp-tool-helpers.c:200:24: error: implicit declaration of function 'strnlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                size_t used_length = strnlen(src, length) >> 1;
                                     ^

Using legacysupport might help.

Change History (6)

comment:1 Changed 8 months ago by mascguy (Christopher Nielsen)

Owner: set to mascguy
Status: newassigned

comment:2 Changed 8 months ago by mascguy (Christopher Nielsen)

Fixed via commit:

In c9ae3871a4c465aff351c22c339d268dd87b2a29/macports-ports (master):

opensc: multiple fixes for build issues

  • Compile with C standard set to 99
  • Enable C extensions for memset_s
  • Disable strict compilation warnings/errors across-the-board

Fixes: #68153

comment:3 Changed 8 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed

comment:4 Changed 8 months ago by jmroot (Joshua Root)

It doesn't look like this is actually fixed: https://build.macports.org/builders/ports-10.6_x86_64-builder/builds/171680/steps/install-port/logs/stdio

openpgp-tool-helpers.c:200:24: warning: implicit declaration of function 'strnlen' is invalid in C99 [-Wimplicit-function-declaration]
                size_t used_length = strnlen(src, length) >> 1;
                                     ^

This file needs to #include "common/compat_strnlen.h".

comment:5 in reply to:  4 Changed 8 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: closedreopened

Replying to jmroot:

It doesn't look like this is actually fixed: https://build.macports.org/builders/ports-10.6_x86_64-builder/builds/171680/steps/install-port/logs/stdio

openpgp-tool-helpers.c:200:24: warning: implicit declaration of function 'strnlen' is invalid in C99 [-Wimplicit-function-declaration]
                size_t used_length = strnlen(src, length) >> 1;
                                     ^

This file needs to #include "common/compat_strnlen.h".

Ah, yep, should have looked more closely.

Thanks for the catch, will take care of this along with your other feedback. (The latter related to use of _DARWIN_C_LEVEL, etc.)

comment:6 Changed 8 months ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: reopenedclosed

In 8c6c09b6e116e6a956f92226f5a1176d3b8d37ef/macports-ports (master):

opensc: correctly enable extensions for memset_s

  • Use legacys-support, for strnlen on 10.6 and earlier
  • Whitelist strchr

Fixes: #68154

Note: See TracTickets for help on using tickets.