Return int from mexp_expect master
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 16 Nov 2023 10:59:54 +0000 (10:59 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 16 Nov 2023 10:59:54 +0000 (10:59 +0000)
GCC 13 highlights the mismatch between int and enum in the declared vs
implemented return type.  The return types are in this case
compatible, but it's not generally safe to implicitly convert between
int and enum.

miniexpect.c:248:1: warning: conflicting types for ‘mexp_expect’ due to enum/integer mismatch; have ‘enum mexp_status(mexp_h *, const mexp_regexp *, pcre2_match_data_8 *)’ {aka ‘enum mexp_status(mexp_h *, const mexp_regexp *, struct pcre2_real_match_data_8 *)’} [-Wenum-int-mismatch]
  248 | mexp_expect (mexp_h *h, const mexp_regexp *regexps,
      | ^~~~~~~~~~~
In file included from miniexpect.c:41:
miniexpect.h:100:12: note: previous declaration of ‘mexp_expect’ with type ‘int(mexp_h *, const mexp_regexp *, pcre2_match_data_8 *)’ {aka ‘int(mexp_h *, const mexp_regexp *, struct pcre2_real_match_data_8 *)’}
  100 | extern int mexp_expect (mexp_h *h, const mexp_regexp *regexps,
      |            ^~~~~~~~~~~

miniexpect.c

index 8533514..9f3b7ba 100644 (file)
@@ -244,7 +244,7 @@ mexp_spawnvf (unsigned flags, const char *file, char **argv)
   return NULL;
 }
 
-enum mexp_status
+int
 mexp_expect (mexp_h *h, const mexp_regexp *regexps,
              pcre2_match_data *match_data)
 {