[gccsdk] autoconfig and regex.h regcomp()

Ron ronanon at zoho.com
Sat Sep 5 18:17:59 PDT 2020


Updated the autobuilder flex patches, but get a regcomp failure from
configure.
It would be good to have a verbose option, because the actual function
used for the test is a hidden macro by the looks.
I downloaded a couple of regex examples.

(using 4.7.4 rel5)


#include <regex.h>
int main() {
  int flags = REG_EXTENDED|REG_ICASE|REG_NEWLINE;
  regex_t  re;
  if (regcomp( re, "^.*$", flags ) != 0)
    return 1;
  return regcomp( re, "|no.*", flags ); }

The implicit strlen function warning can be fixed but

ac_arch_reg.c:7:3: warning: implicit declaration of function
 'ul_regcomp' [-Wimplicit-function-declaration]

though only a warning, does not compile.

The following example does compile and work

#include <sys/types.h>
#include <regex.h>
/* to fix implicit declaration of strlen and undeclared NULL error*/
#include <string.h>
int main() {
regex_t r; regmatch_t rm;
if (regcomp(&r, "abc", 0)) return(1);
if (regexec(&r, "xabcy", 1, &rm, 0)) return(1);
if (rm.rm_so != 1) return(1); /* check for correct offset */
return(0);
}

/* *show sys$returncode
Sys$ReturnCode : 0 */

Ronald




More information about the gcc mailing list