Opened 7 months ago

Last modified 7 months ago

#62307 accepted defect

gnuregex @0.12_2: error: implicit declaration of function 'free' is invalid in C99

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

Description

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

make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_gnuregex/gnuregex/work/regex-0.12'
/usr/bin/clang -g  -DHAVE_STRING_H=1 -Dconst= -I. -I. -c regex.c
regex.c:69:7: warning: incompatible redeclaration of library function 'malloc' [-Wincompatible-library-redeclaration]
char *malloc ();
      ^
regex.c:69:7: note: 'malloc' is a builtin with type 'void *(unsigned long)'
regex.c:70:7: warning: incompatible redeclaration of library function 'realloc' [-Wincompatible-library-redeclaration]
char *realloc ();
      ^
regex.c:70:7: note: 'realloc' is a builtin with type 'void *(void *, unsigned long)'
regex.c:1629:17: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                else
                ^
regex.c:1649:17: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                else
                ^
regex.c:2042:3: error: implicit declaration of function 'free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  free (compile_stack.stack);
  ^
regex.c:2784:11: error: implicitly declaring library function 'abort' with type 'void (void) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
          abort (); /* We have listed all the cases.  */
          ^
regex.c:2784:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'abort'
regex.c:2834:33: warning: expression which evaluates to zero treated as a null pointer constant of type 'regoff_t *' (aka 'int *') [-Wnon-literal-null-conversion]
      regs->start = regs->end = (regoff_t) 0;
                                ^~~~~~~~~~~~
regex.c:3771:19: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
                  PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
                  ^
regex.c:2407:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (lowest_active_reg);                              \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:3771:19: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
regex.c:2410:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (highest_active_reg);                             \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:3918:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
          PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
          ^
regex.c:2407:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (lowest_active_reg);                              \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:3918:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
regex.c:2410:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (highest_active_reg);                             \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:3971:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
          PUSH_FAILURE_POINT (p + mcnt, d, -2);
          ^
regex.c:2407:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (lowest_active_reg);                              \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:3971:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
regex.c:2410:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (highest_active_reg);                             \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:4110:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
          PUSH_FAILURE_POINT (0, 0, -2);
          ^
regex.c:2407:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (lowest_active_reg);                              \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:4110:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
regex.c:2410:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (highest_active_reg);                             \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:4123:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
          PUSH_FAILURE_POINT (0, 0, -2);
          ^
regex.c:2407:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (lowest_active_reg);                              \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:4123:11: warning: cast to 'fail_stack_elt_t' (aka 'unsigned char *') from smaller integer type 'unsigned int' [-Wint-to-pointer-cast]
regex.c:2410:5: note: expanded from macro 'PUSH_FAILURE_POINT'
    PUSH_FAILURE_ITEM (highest_active_reg);                             \
    ^
regex.c:2328:42: note: expanded from macro 'PUSH_FAILURE_ITEM'
  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
                                         ^
regex.c:4863:7: error: implicit declaration of function 'free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      free (regs.start);
      ^
regex.c:4924:5: error: implicit declaration of function 'free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    free (preg->buffer);
    ^
15 warnings and 4 errors generated.
make: *** [regex.o] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_gnuregex/gnuregex/work/regex-0.12'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_gnuregex/gnuregex/work/regex-0.12" && /usr/bin/make -j16 -w all subdirs=test 
Exit code: 2
Error: Failed to build gnuregex: command execution failed
DEBUG: Error code: CHILDSTATUS 69307 2

Change History (1)

comment:1 Changed 7 months ago by ryandesign (Ryan Schmidt)

Owner: set to ryandesign
Status: newaccepted

This software was released in 1993 so it is not at all surprising that it does not conform to C99.

Note: See TracTickets for help on using tickets.