[MacPorts] #62304: sudosh @1.6.3: error: implicit declaration of function 'gettimeofday' is invalid in C99

MacPorts noreply at macports.org
Mon Feb 15 23:06:29 UTC 2021


#62304: sudosh @1.6.3: error: implicit declaration of function 'gettimeofday' is
invalid in C99
-----------------------------+--------------------
 Reporter:  cooljeanius      |      Owner:  (none)
     Type:  defect           |     Status:  new
 Priority:  Normal           |  Milestone:
Component:  ports            |    Version:  2.6.4
 Keywords:  bigsur catalina  |       Port:  sudosh
-----------------------------+--------------------
 Another victim of -Werror=implicit-function-declaration being on by
 default now:
 {{{
 Making all in src
 make[2]: Entering directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3/src'
 if /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -pipe -Os
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64
 -MT sudosh.o -MD -MP -MF ".deps/sudosh.Tpo" -c -o sudosh.o sudosh.c; \
         then mv -f ".deps/sudosh.Tpo" ".deps/sudosh.Po"; else rm -f
 ".deps/sudosh.Tpo"; exit 1; fi
 if /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -pipe -Os
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64
 -MT rand.o -MD -MP -MF ".deps/rand.Tpo" -c -o rand.o rand.c; \
         then mv -f ".deps/rand.Tpo" ".deps/rand.Po"; else rm -f
 ".deps/rand.Tpo"; exit 1; fi
 rand.c:12:5: error: implicit declaration of function 'gettimeofday' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
     gettimeofday(&tv, NULL);
     ^
 1 error generated.
 sudosh.c:248:24: warning: using the result of an assignment as a condition
 without parentheses [-Wparentheses]
     while (user.vshell = (char *) getusershell()) {
            ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
 sudosh.c:248:24: note: place parentheses around the assignment to silence
 this warning
     while (user.vshell = (char *) getusershell()) {
                        ^
            (                                    )
 sudosh.c:248:24: note: use '==' to turn this assignment into an equality
 comparison
     while (user.vshell = (char *) getusershell()) {
                        ^
                        ==
 sudosh.c:286:144: warning: format specifies type 'int' but the argument
 has type 'time_t' (aka 'long') [-Wformat]
     snprintf(script.name, (size_t) BUFSIZ - 1,
 "%s/%s%s%s%sscript%s%i%s%s", LOGDIR, user.from, FILEDELIMIT, user.to,
 FILEDELIMIT, FILEDELIMIT, now, FILEDELIMIT, rand);
                                                                    ~~
 ^~~
                                                                    %li
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62:
 note: expanded from macro 'snprintf'
   __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                              ^~~~~~~~~~~
 sudosh.c:287:142: warning: format specifies type 'int' but the argument
 has type 'time_t' (aka 'long') [-Wformat]
     snprintf(timing.name, (size_t) BUFSIZ - 1, "%s/%s%s%s%stime%s%i%s%s",
 LOGDIR, user.from, FILEDELIMIT, user.to, FILEDELIMIT, FILEDELIMIT, now,
 FILEDELIMIT, rand);
                                                                  ~~
 ^~~
                                                                  %li
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62:
 note: expanded from macro 'snprintf'
   __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                              ^~~~~~~~~~~
 sudosh.c:288:142: warning: format specifies type 'int' but the argument
 has type 'time_t' (aka 'long') [-Wformat]
     snprintf(input.name, (size_t) BUFSIZ - 1, "%s/%s%s%s%sinput%s%i%s%s",
 LOGDIR, user.from, FILEDELIMIT, user.to, FILEDELIMIT, FILEDELIMIT, now,
 FILEDELIMIT, rand);
                                                                  ~~
 ^~~
                                                                  %li
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62:
 note: expanded from macro 'snprintf'
   __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                              ^~~~~~~~~~~
 sudosh.c:374:3: error: implicit declaration of function 'do_write' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 WRITE(1, iobuf, n);
                 ^
 sudosh.c:83:24: note: expanded from macro 'WRITE'
 #define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
                        ^
 make[2]: *** [rand.o] Error 1
 make[2]: *** Waiting for unfinished jobs....
 sudosh.c:381:3: error: implicit declaration of function 'do_write' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 WRITE(timing.fd, &timing.str, strlen(timing.str));
                 ^
 sudosh.c:83:24: note: expanded from macro 'WRITE'
 #define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
                        ^
 sudosh.c:388:3: error: implicit declaration of function 'do_write' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 WRITE(pspair.mfd, iobuf, n);
                 ^
 sudosh.c:83:24: note: expanded from macro 'WRITE'
 #define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
                        ^
 sudosh.c:495:12: error: implicit declaration of function 'ioctl' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
     (void) ioctl(0, TIOCSWINSZ, &winorig);
            ^
 sudosh.c:539:9: error: implicit declaration of function 'ioctl' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
     if (ioctl(ttyfd, TIOCGWINSZ, &winorig) == -1) {
         ^
 sudosh.c:577:9: error: implicit declaration of function 'ioctl' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
     if (ioctl(0, TIOCGWINSZ, &winorig) != -1) {
         ^
 sudosh.c:648:11: warning: using the result of an assignment as a condition
 without parentheses [-Wparentheses]
     if (s = write(fd, buf, size) < 0) {
         ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
 sudosh.c:648:11: note: place parentheses around the assignment to silence
 this warning
     if (s = write(fd, buf, size) < 0) {
           ^
         (                           )
 sudosh.c:648:11: note: use '==' to turn this assignment into an equality
 comparison
     if (s = write(fd, buf, size) < 0) {
           ^
           ==
 5 warnings and 6 errors generated.
 make[2]: *** [sudosh.o] Error 1
 make[2]: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3/src'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3'
 make: *** [all] Error 2
 make: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3'
 Command failed:  cd
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3"
 && /usr/bin/make -j16 -w all
 Exit code: 2
 Error: Failed to build sudosh: command execution failed
 DEBUG: Error code: CHILDSTATUS 61728 2
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/62304>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list