Opened 3 years ago

Closed 3 years ago

#62303 closed defect (fixed)

mcpp @2.7.2_5: error: implicitly declaring library function 'stpcpy'

Reported by: cooljeanius (Eric Gallager) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur catalina Cc:
Port: mcpp

Description

Another victim of -Werror=implicit-function-declaration being on by default now:

 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c main.c  -fno-common -DPIC -o .libs/main.o
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c mbchar.c  -fno-common -DPIC -o .libs/mbchar.o
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c system.c  -fno-common -DPIC -o .libs/system.o
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c directive.c  -fno-common -DPIC -o .libs/directive.o
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c support.c  -fno-common -DPIC -o .libs/support.o
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c eval.c  -fno-common -DPIC -o .libs/eval.o
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c expand.c  -fno-common -DPIC -o .libs/expand.o
main.c:779:23: error: implicitly declaring library function 'stpcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
                cp1 = stpcpy( output, "pragma ");   /* From top of buffer   */
                      ^
main.c:779:23: note: include the header <string.h> or explicitly provide a declaration for 'stpcpy'
1 error generated.
make[2]: *** [main.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
system.c:2510:20: error: implicit declaration of function 'readlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if ((len = readlink( slbuf1, slbuf2, PATHMAX)) > 0) {
                   ^
system.c:2623:15: error: implicitly declaring library function 'stpcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
        cp1 = stpcpy( abs_path, cur_work_dir);
              ^
system.c:2623:15: note: include the header <string.h> or explicitly provide a declaration for 'stpcpy'
system.c:2685:20: error: implicit declaration of function 'readlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if ((len = readlink( slbuf1, slbuf2, PATHMAX)) > 0) {
                   ^
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c mbchar.c -o mbchar.o >/dev/null 2>&1
support.c:530:19: error: implicitly declaring library function 'stpcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
            out = stpcpy( out, identifier);
                  ^
support.c:530:19: note: include the header <string.h> or explicitly provide a declaration for 'stpcpy'
system.c:4245:20: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    once_end->name = fullname;
                   ^ ~~~~~~~~
directive.c:1212:20: error: implicitly declaring library function 'stpcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
        repl_cur = stpcpy( repl_cur, identifier);
                   ^
directive.c:1212:20: note: include the header <string.h> or explicitly provide a declaration for 'stpcpy'
1 warning and 3 errors generated.
support.c:1590:15: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        free( file->src_dir);
              ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/malloc/_malloc.h:42:18: note: passing argument to parameter here
void     free(void *);
                    ^
support.c:1596:15: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        free( file->src_dir);               /* Free src_dir         */
              ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/malloc/_malloc.h:42:18: note: passing argument to parameter here
void     free(void *);
                    ^
support.c:1599:22: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        cur_fullname = infile->full_fname;
                     ^ ~~~~~~~~~~~~~~~~~~
1 error generated.
expand.c:427:16: error: implicitly declaring library function 'stpcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
        *opp = stpcpy( *opp, "*/");
               ^
expand.c:427:16: note: include the header <string.h> or explicitly provide a declaration for 'stpcpy'
support.c:2303:17: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        strcpy( file->src_dir, src_dir);
                ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:84:27: note: expanded from macro 'strcpy'
                __builtin___strcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                        ^~~~
make[2]: *** [system.lo] Error 1
expand.c:713:21: warning: incompatible pointer types assigning to 'char *' from 'LOCATION *' (aka 'struct location *') [-Wincompatible-pointer-types]
        m_inf->args = m_inf->loc_args = NULL;       /* Default args */
                    ^ ~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [directive.lo] Error 1
4 warnings and 1 error generated.
make[2]: *** [support.lo] Error 1
expand.c:1975:41: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                            mgc_cleared = remove_magics(
                                        ^ ~~~~~~~~~~~~~~
2 warnings and 1 error generated.
make[2]: *** [expand.lo] Error 1
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -c eval.c -o eval.o >/dev/null 2>&1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mcpp/mcpp/work/mcpp-2.7.2/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mcpp/mcpp/work/mcpp-2.7.2/src'
make: *** [all-recursive] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mcpp/mcpp/work/mcpp-2.7.2'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mcpp/mcpp/work/mcpp-2.7.2" && /usr/bin/make -j16 -w all CFLAGS+='-arch x86_64' 
Exit code: 2
Error: Failed to build mcpp: command execution failed
DEBUG: Error code: CHILDSTATUS 54467 2

Change History (2)

comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Status: newaccepted

comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 180542b207b01bca1f06f263b7719cbc51c1a078/macports-ports (master):

mcpp: Fix implicit declaration of functions

Closes: #62303

Also modernize checksums and remove weird unnecessary method of
specifying -arch flags which really only had the effect of replacing the
MacPorts flags with only the -arch flags. By removing this code, now all
flags, including optimization flags, are specified; therefore increase
revision.

Note: See TracTickets for help on using tickets.