westes / flex

The Fast Lexical Analyzer - scanner generator for lexing in C and C++
Other
3.61k stars 537 forks source link

Compile failed on MacOS 12.4 (arm chip) #539

Closed wendajiang closed 1 year ago

wendajiang commented 2 years ago

clang 13 or gcc 12 both compile error

./cpp-flex.h:9:69: error: expected expression
  "m4_define([[M4_PROPERTY_TRACE_LINE_REGEXP]], [[^#line ([0-9]+) ",\"(.*)\"]])
                                                                    ^
./cpp-flex.h:9:70: warning: missing terminating '"' character [-Winvalid-pp-token]
  "m4_define([[M4_PROPERTY_TRACE_LINE_REGEXP]], [[^#line ([0-9]+) ",\"(.*)\"]])

It look like m4 process error.

My m4 version is

image

and generate cpp-flex.h

image

As I'm not familiar with m4, why it generate the ",\" ?

wendajiang commented 2 years ago

https://github.com/westes/flex/pull/353 resolve this

wendajiang commented 2 years ago

After resolve mkskl.sh, new problem occur:

./stage1flex   -o stage1scan.c ./scan.l
./stage1flex: fatal internal error, exec of /opt/homebrew/opt/m4/bin/m4 failed
biergaizi commented 1 year ago

I created Pull Request #554 to fix this problem. Please take a try.

wendajiang commented 1 year ago

scan.l:677:10: error: call to undeclared function 'yyinput'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] if ( yyinput() != ']' ) ^ scan.l:677:10: note: did you mean 'yyunput'? scan.c:2266:17: note: 'yyunput' declared here static void yyunput ( int c, char *buf_ptr );

353 resolve this

And this pr not merged.

biergaizi commented 1 year ago

I'm not the maintainer but I noticed that you're reporting two bugs in the same issue. I suggest you to open another bug for the original issue.