Patch cool.flex for flex > 2.5.39
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
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).
This commit is contained in:
parent
4fdaf40671
commit
5ef0aff5b5
2 changed files with 28 additions and 0 deletions
|
@ -49,6 +49,14 @@ RUN sed -i 's/-zx/-ozx/g' \
|
|||
/usr/class/assignments/PA4J/grade.pl /usr/class/assignments/PA4/grade.pl \
|
||||
/usr/class/assignments/PA5J/grade.pl /usr/class/assignments/PA5/grade.pl
|
||||
|
||||
# Patch cool.flex in submission folder
|
||||
# This is a hack to
|
||||
# a) satisfy the cool compiler which expects yylex to be named cool_yylex
|
||||
# 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
|
||||
RUN patch -u /usr/class/assignments/PA2/cool.flex -i cool.flex.patch
|
||||
|
||||
# Setup working directory
|
||||
RUN mkdir -p /class
|
||||
WORKDIR /class
|
||||
|
|
20
cool.flex.patch
Normal file
20
cool.flex.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- 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
|
Loading…
Reference in a new issue