[MacPorts] #62919: pamtester @0.1.2: error: implicitly declaring library function 'sprintf' with type 'int (char *, const char *, ...)'

MacPorts noreply at macports.org
Tue May 18 12:31:31 UTC 2021


#62919: pamtester @0.1.2: error: implicitly declaring library function 'sprintf'
with type 'int (char *, const char *, ...)'
-----------------------------+-----------------------
 Reporter:  cooljeanius      |      Owner:  (none)
     Type:  defect           |     Status:  new
 Priority:  Normal           |  Milestone:
Component:  ports            |    Version:  2.6.4
 Keywords:  bigsur catalina  |       Port:  pamtester
-----------------------------+-----------------------
 Another victim of `-Werror=implicit-function-declaration` being on by
 default now:
 {{{
 make[2]: Entering directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_pamtester/pamtester/work/pamtester-0.1.2/src'
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -Wall -c
 app.c
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -Wall -c
 expr_parser.c
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -Wall -c
 parse_opts.c
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -Wall -c
 pamtester.c
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -Wall -c
 util.c
 /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -Wall -c
 compat.c
 parse_opts.c:85:11: error: implicitly declaring library function 'sprintf'
 with type 'int (char *, const char *, ...)' [-Werror,-Wimplicit-function-
 declaration]
 sprintf(*err_msg, "Option \"%s\" may not be specified twice or more",
 opt->long_name);
 ^
 parse_opts.c:85:11: note: include the header <stdio.h> or explicitly
 provide a declaration for 'sprintf'
 pamtester.c:65:33: error: implicitly declaring library function 'strtoul'
 with type 'unsigned long (const char *, char **, int)' [-Werror
 ,-Wimplicit-function-declaration]
         x->verbose = (val == NULL ? 1: strtoul(val, NULL, 10));
                                        ^
 pamtester.c:65:33: note: include the header <stdlib.h> or explicitly
 provide a declaration for 'strtoul'
 1 error generated.
 expr_parser.c:87:10: error: implicitly declaring library function 'strtol'
 with type 'long (const char *, char **, int)' [-Werror,-Wimplicit-
 function-declaration]
                         val = strtol(token_val, &next_ptr, 10);
                               ^
 expr_parser.c:87:10: note: include the header <stdlib.h> or explicitly
 provide a declaration for 'strtol'
 util.c:77:3: error: implicit declaration of function 'free' is invalid in
 C99 [-Werror,-Wimplicit-function-declaration]
                 free(ptr);
                 ^
 util.c:77:3: note: did you mean 'xfree'?
 util.c:74:6: note: 'xfree' declared here
 void xfree(void *ptr)
      ^
 util.c:87:40: error: implicitly declaring library function 'malloc' with
 type 'void *(unsigned long)' [-Werror,-Wimplicit-function-declaration]
                         || NULL == (retval = (ptr == NULL ? malloc(total):
 realloc(ptr, total)))) {
                                                             ^
 util.c:87:40: note: include the header <stdlib.h> or explicitly provide a
 declaration for 'malloc'
 util.c:87:55: error: implicitly declaring library function 'realloc' with
 type 'void *(void *, unsigned long)' [-Werror,-Wimplicit-function-
 declaration]
                         || NULL == (retval = (ptr == NULL ? malloc(total):
 realloc(ptr, total)))) {
 ^
 util.c:87:55: note: include the header <stdlib.h> or explicitly provide a
 declaration for 'realloc'
 util.c:88:3: error: implicit declaration of function 'fprintf' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "FATAL: Allocation failure.\n");
                 ^
 util.c:88:3: warning: declaration of built-in function 'fprintf' requires
 inclusion of the header <stdio.h> [-Wbuiltin-requires-header]
 pamtester.c:146:3: error: implicit declaration of function 'fprintf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "usage: %s [-Eenv=value] [-Iparam=value]
 service user op_name ...\n", prog_name);
                 ^
 pamtester.c:146:3: warning: declaration of built-in function 'fprintf'
 requires inclusion of the header <stdio.h> [-Wbuiltin-requires-header]
 1 error generated.
 pamtester.cutil.c:88:11: error: use of undeclared identifier 'stderr'
 :146:11: error: use of undeclared identifier 'stderr'
 make[2]: *** [parse_opts.o] Error 1
                 fprintf(stderr, "FATAL: Allocation failure.\n");
                         ^
 make[2]: *** Waiting for unfinished jobs....
                 fprintf(stderr, "usage: %s [-Eenv=value] [-Iparam=value]
 service user op_name ...\n", prog_name);
                         ^
 util.cpamtester.c:147::893::3 :error:  error: implicitly declaring library
 function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
 ,-Wimplicit-function-declaration]
 implicitly declaring library function 'exit' with type 'void (int)
 __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
                 exit(-1);
                 ^
                 exit(-1);pamtester.c:
                 ^147
 :3: noteutil.c:89:: 3: include the header <stdlib.h> or explicitly provide
 a declaration for 'exit'
 note: include the header <stdlib.h> or explicitly provide a declaration
 for 'exit'
 pamtester.c:153:3: error: implicit declaration of function 'fprintf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "%s: %s\n", prog_name, err_msg);
                 ^
 pamtester.c:153:11: error: use of undeclared identifier 'stderr'
                 fprintf(stderr, "%s: %s\n", prog_name, err_msg);
                         ^
 pamtester.c:160:3: error: implicit declaration of function 'fprintf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "%s: please specify service name.\n",
 prog_name);
                 ^
 pamtester.c:160:11: error: use of undeclared identifier 'stderr'
                 fprintf(stderr, "%s: please specify service name.\n",
 prog_name);
                         ^
 pamtester.c:168:3: error: implicit declaration of function 'fprintf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "%s: please specify user name.\n",
 prog_name);
                 ^
 pamtester.c:168:11: error: use of undeclared identifier 'stderr'
                 fprintf(stderr, "%s: please specify user name.\n",
 prog_name);
                         ^
 pamtester.c:176:3: error: implicit declaration of function 'fprintf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "%s: specify one or more operations.\n",
 prog_name);
                 ^
 pamtester.c:176:11: error: use of undeclared identifier 'stderr'
                 fprintf(stderr, "%s: specify one or more operations.\n",
 prog_name);
                         ^
 1 warning and 6 errors generated.
 pamtester.c:196:5: error: implicit declaration of function 'fprintf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                                 fprintf(stderr, "%s: incorrect op_name
 spec \"%s\".", prog_name, op_spec);
                                 ^
 pamtester.c:196:13: error: use of undeclared identifier 'stderr'
                                 fprintf(stderr, "%s: incorrect op_name
 spec \"%s\".", prog_name, op_spec);
                                         ^
 make[2]: *** [expr_parser.o] Error 1
 1 warning and 14 errors generated.
 make[2]: *** [util.o] Error 1
 app.c:209:3: error: implicit declaration of function 'fprintf' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "%s: invoking pam_start(%s, %s, ...)\n",
 params->app_name, params->service, params->user);
                 ^
 make[2]: *** [pamtester.o] Error 1
 app.c:209:3: warning: declaration of built-in function 'fprintf' requires
 inclusion of the header <stdio.h> [-Wbuiltin-requires-header]
 compat.c:61:40: error: unknown type name 'FILE'
 static char *pamtester_compat_readline(FILE *fp)
                                        ^
 app.c:209:11: error: use of undeclared identifier 'stderr'
                 fprintf(stderr, "%s: invoking pam_start(%s, %s, ...)\n",
 params->app_name, params->service, params->user);
                         ^
 app.ccompat.c:76:5:224::4 error: error: : implicitly declaring library
 function 'sprintf' with type 'int (char *, const char *, ...)' [-Werror
 ,-Wimplicit-function-declaration]
 implicit declaration of function 'fprintf' is invalid in C99 [-Werror
 ,-Wimplicit-function-declaration]
                         sprintf(err_msg, "Unknown item type \"%s\"",
 item->name);
                         ^
                                 fprintf(stderr, "Unable to allocate memory
 %f bytes",
                                 ^
 app.c:224:4: note: include the header <stdio.h> or explicitly provide a
 declaration for 'sprintf'
 app.c:243:4: error: implicit declaration of function 'fprintf' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
                         fprintf(stderr, "%s: performing operation - %s\n",
 params->app_name, op->name);
                         ^
 compat.c:76:5: warning: declaration of built-in function 'fprintf'
 requires inclusion of the header <stdio.h> [-Wbuiltin-requires-header]
 app.c:243:12: error: use of undeclared identifier 'stderr'
                         fprintf(stderr, "%s: performing operation - %s\n",
 params->app_name, op->name);
                                 ^
 app.c:277:5: error: implicitly declaring library function 'printf' with
 type 'int (const char *, ...)' [-Werror,-Wimplicit-function-declaration]
                                 printf("%s: successfully authenticated\n",
 params->app_name);
                                 ^
 app.c:277:5: note: include the header <stdio.h> or explicitly provide a
 declaration for 'printf'
 compat.c:76:13: error: use of undeclared identifier 'stderr'
                                 fprintf(stderr, "Unable to allocate memory
 %f bytes",
                                         ^
 compat.c:85:12: error: implicit declaration of function 'fgets' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
                 if ((p = fgets(&buf[offset], nbytes_to_read, fp)) == NULL)
 {
                          ^
 app.c:454:3: error: implicit declaration of function 'fprintf' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
                 fprintf(stderr, "%s: %s\n", params->app_name, err_msg);
                 ^
 compat.c:111:59: error: unknown type name 'FILE'
 static void pamtester_compat_put_message(const char *msg, FILE *fp)
                                                           ^
 compat.c:113:2: error: implicit declaration of function 'fwrite' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
         fwrite(msg, sizeof(msg[0]), strlen(msg), fp);
         ^
 app.c:454:11: error: use of undeclared identifier 'stderr'
                 fprintf(stderr, "%s: %s\n", params->app_name, err_msg);
                         ^
 compat.c:113:2: warning: declaration of built-in function 'fwrite'
 requires inclusion of the header <stdio.h> [-Wbuiltin-requires-header]
 compat.c:114:2: error: implicit declaration of function 'fflush' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
         fflush(fp);
         ^
 1 warning and 8 errors generated.
 compat.c:114:2: note: did you mean 'tcflush'?
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/termios.h:339:9:
 note: 'tcflush' declared here
 int     tcflush(int, int);
         ^
 compat.c:121:36: error: use of undeclared identifier 'stdout'
         pamtester_compat_put_message(msg, stdout);
                                           ^
 compat.c:122:2: error: implicit declaration of function 'setvbuf' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
         setvbuf(stdin, NULL, _IONBF, 0);
         ^
 compat.c:122:10: error: use of undeclared identifier 'stdin'
         setvbuf(stdin, NULL, _IONBF, 0);
                 ^
 compat.c:122:23: error: use of undeclared identifier '_IONBF'
         setvbuf(stdin, NULL, _IONBF, 0);
                              ^
 compat.c:125:39: error: use of undeclared identifier 'stdin'
                 retval =  pamtester_compat_readline(stdin);
                                                     ^
 compat.c:129:13: error: implicit declaration of function 'fileno' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
                 tcgetattr(fileno(stdin), &tstat);
                           ^
 compat.c:129:20: error: use of undeclared identifier 'stdin'
                 tcgetattr(fileno(stdin), &tstat);
                                  ^
 compat.c:132:20: error: use of undeclared identifier 'stdin'
                 tcsetattr(fileno(stdin), TCSAFLUSH, &tstat);
                                  ^
 compat.c:134:38: error: use of undeclared identifier 'stdin'
                 retval = pamtester_compat_readline(stdin);
                                                    ^
 compat.c:137:20: error: use of undeclared identifier 'stdin'
                 tcsetattr(fileno(stdin), TCSADRAIN, &tstat);
                                  ^
 compat.c:140:37: error: use of undeclared identifier 'stdout'
         pamtester_compat_put_message("\n", stdout);
                                            ^
 make[2]: *** [app.o] Error 1
 compat.c:169:44: error: use of undeclared identifier 'stderr'
                                 pamtester_compat_put_message(msg->msg,
 stderr);
                                                                        ^
 fatal error: too many errors emitted, stopping now [-ferror-limit=]
 2 warnings and 20 errors generated.
 make[2]: *** [compat.o] Error 1
 make[2]: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_pamtester/pamtester/work/pamtester-0.1.2/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_devel_pamtester/pamtester/work/pamtester-0.1.2'
 make: *** [all-recursive-am] Error 2
 make: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_pamtester/pamtester/work/pamtester-0.1.2'
 Command failed:  cd
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_pamtester/pamtester/work/pamtester-0.1.2"
 && /usr/bin/make -j16 -w all
 Exit code: 2
 Error: Failed to build pamtester: command execution failed
 DEBUG: Error code: CHILDSTATUS 98546 2
 }}}

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


More information about the macports-tickets mailing list