lukewarm/cool.flex.patch
Armin Friedl 5ef0aff5b5
Some checks failed
continuous-integration/drone/push Build is failing
Patch cool.flex for flex > 2.5.39
flex (and libfl) expect a symbol yyflex. This symbol is overwritten and expected
to be cool_yyflex in the cool compiler. This patch makes both happy. In addition
fixes name mangling issues with c++ compilers which otherwise may mangle
yyflex (which is a fixed symbol in c-compiled libfl).
2020-12-20 00:00:09 +01:00

20 lines
672 B
Diff

--- cool.flex 2011-06-18 03:22:02.000000000 +0000
+++ cool.flex.work 2020-12-19 22:43:35.902153646 +0000
@@ -12,6 +12,17 @@
#include <stringtab.h>
#include <utilities.h>
+/* This is a hack to
+ * a) satisfy the cool compiler which expects yylex to be named cool_yylex (see below)
+ * b) satisfy libfl > 2.5.39 which expects a yylex symbol
+ * c) fix mangling errors of yylex when compiled with a c++ compiler
+ * d) be as non-invasive as possible to the existing assignment code
+ */
+extern int cool_yylex();
+extern "C" {
+ int (&yylex) (void) = cool_yylex;
+}
+
/* The compiler assumes these identifiers. */
#define yylval cool_yylval
#define yylex cool_yylex