[MacPorts] #62594: yydecode @0.2.10: error: implicitly declaring library function 'strcmp'
MacPorts
noreply at macports.org
Thu Apr 1 01:18:46 UTC 2021
#62594: yydecode @0.2.10: error: implicitly declaring library function 'strcmp'
--------------------------+-----------------------------
Reporter: cooljeanius | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.4
Resolution: | Keywords: bigsur catalina
Port: yydecode |
--------------------------+-----------------------------
Comment (by ryandesign):
This problem is in the project's bundled getopt.c. I've seen this before
but never know how to fix it. Normally the obvious fix would be to include
the header that defines the function, in this case <string.h>. However
getopt.c goes to great lengths to deliberately avoid including <string.h>:
{{{
#if defined (__GNU_LIBRARY__) || defined (__sgi)
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
#else
/* Avoid depending on library functions or files
whose names are inconsistent. */
extern char *getenv ();
extern int strncmp (const char *s1, const char *s2, size_t len);
static char *
my_index (str, chr)
const char *str;
int chr;
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
#if !__STDC__
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
#endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
}}}
What is the right fix? Presumably later versions of getopt.c have
corrected this. How did they do it? Where is upstream for getopt.c?
--
Ticket URL: <https://trac.macports.org/ticket/62594#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list