Also patch cool.y in PA3
All checks were successful
continuous-integration/drone/push Build is passing

Same issue as in 5ef0aff5b5
This commit is contained in:
Armin Friedl 2020-12-22 02:59:29 +01:00
parent 05a3784af3
commit 5a5b9d9e09
2 changed files with 29 additions and 2 deletions

View file

@ -52,13 +52,14 @@ RUN sed -i 's/-zx/-ozx/g' \
/usr/class/assignments/PA4J/grade.pl /usr/class/assignments/PA4/grade.pl \ /usr/class/assignments/PA4J/grade.pl /usr/class/assignments/PA4/grade.pl \
/usr/class/assignments/PA5J/grade.pl /usr/class/assignments/PA5/grade.pl /usr/class/assignments/PA5J/grade.pl /usr/class/assignments/PA5/grade.pl
# Patch cool.flex in submission folder # Patch cool.flex, cool.y in submission folder
# This is a hack to # This is a hack to
# a) satisfy the cool compiler which expects yylex to be named cool_yylex # a) satisfy the cool compiler which expects yylex to be named cool_yylex
# b) satisfy libfl > 2.5.39 which expects a yylex symbol # b) satisfy libfl > 2.5.39 which expects a yylex symbol
# c) fix mangling errors of yylex when compiled with a c++ compiler # c) fix mangling errors of yylex when compiled with a c++ compiler
# d) be as non-invasive as possible to the existing assignment code # d) be as non-invasive as possible to the existing assignment code
RUN patch -u /usr/class/assignments/PA2/cool.flex -i /tmp/build/cool.flex.patch RUN patch -u /usr/class/assignments/PA2/cool.flex -i /tmp/build/cool.flex.patch \
&& patch -u /usr/class/assignments/PA3/cool.y -i /tmp/build/cool.y.patch
# Setup working directory # Setup working directory
RUN mkdir -p /class RUN mkdir -p /class

26
cool.y.patch Normal file
View file

@ -0,0 +1,26 @@
--- cool.y 2020-12-22 01:57:18.912461835 +0000
+++ cool.y.work 2020-12-22 01:57:06.089590582 +0000
@@ -11,6 +11,23 @@
extern char *curr_filename;
+ /* 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
+ *
+ * WARNING: We are now leaving standard country, but `push_macro` is supported
+ * in all major compilers.
+ */
+ #pragma push_macro("yylex")
+ #undef yylex
+ int cool_yylex();
+ extern "C" {
+ int (&yylex) (void) = cool_yylex;
+ }
+ #pragma pop_macro("yylex")
+
/* Locations */
#define YYLTYPE int /* the type of locations */