-
Notifications
You must be signed in to change notification settings - Fork 236
Compilation fixes for DJGPP #1287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
LGTM. @bnoordhuis thoughts? @rkd77 is it possible to add a CI build check for this? |
bnoordhuis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with djgpp support but this needs some work. Question: does djgpp not have <fenv.h>? Seems inconceivable, it's a standard header.
Apropos fmin and fmax, if they really don't exist in djgpp's libm, then we might as well open-code them in quickjs.c. We use them in only one place.
quickjs.c
Outdated
| } | ||
|
|
||
| #undef NAN | ||
| #define NAN (0.0f / 0.0f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #define NAN (0.0f / 0.0f) | |
| #define NAN (0.0 / 0.0) |
(should be double, not float)
|
djgpp is available in version 12.2.0, and there is no fenv.h there. At least I have not found it. |
It was reported that DJGPP lacks fmin and fmax. The surrounding code code already takes care of NaNs and signed zeros, so there is no real need to call out to said functions. Refs: quickjs-ng#1287
|
When added #1276 compiles fine on crossdjgpp. |
It was reported that DJGPP lacks fmin and fmax. The surrounding code code already takes care of NaNs and signed zeros, so there is no need to call out to said functions. Refs: #1287
|
@rkd77 with those two prs merged, can you rebase/update this pr? Thanks. |
I just want a library only, so changes to the library code. It is the first step. I compiled library by these commands: mkdir build cd build cmake .. make clean /usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/cutils.c.o -MF CMakeFiles/qjs.dir/cutils.c.o.d -o CMakeFiles/qjs.dir/cutils.c.o -c /home/git/GIT/quickjs/cutils.c /usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/dtoa.c.o -MF CMakeFiles/qjs.dir/dtoa.c.o.d -o CMakeFiles/qjs.dir/dtoa.c.o -c /home/git/GIT/quickjs/dtoa.c /usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/libregexp.c.o -MF CMakeFiles/qjs.dir/libregexp.c.o.d -o CMakeFiles/qjs.dir/libregexp.c.o -c /home/git/GIT/quickjs/libregexp.c /usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/libunicode.c.o -MF CMakeFiles/qjs.dir/libunicode.c.o.d -o CMakeFiles/qjs.dir/libunicode.c.o -c /home/git/GIT/quickjs/libunicode.c /usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/quickjs.c.o -MF CMakeFiles/qjs.dir/quickjs.c.o.d -o CMakeFiles/qjs.dir/quickjs.c.o -c /home/git/GIT/quickjs/quickjs.c /usr/bin/i586-pc-msdosdjgpp-ar qc libqjs.a CMakeFiles/qjs.dir/cutils.c.o CMakeFiles/qjs.dir/dtoa.c.o CMakeFiles/qjs.dir/libregexp.c.o CMakeFiles/qjs.dir/libunicode.c.o CMakeFiles/qjs.dir/quickjs.c.o /usr/bin/ranlib libqjs.a
|
I'm not too familiar with git, the patch recreated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with two final flourishes.
quickjs.c
Outdated
| #ifndef __DJGPP | ||
| #include <fenv.h> | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the header can simply be removed, I don't think there's anything still using it. Neither was there before I removed fmin/fmax, those live in math.h.
| #ifndef __DJGPP | |
| #include <fenv.h> | |
| #endif |
no need for cast Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
|
Added two commits. |
I just want a library only, so changes to the library code. It is the first step.
I compiled library by these commands:
mkdir build
cd build
cmake ..
make clean
/usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/cutils.c.o -MF CMakeFiles/qjs.dir/cutils.c.o.d -o CMakeFiles/qjs.dir/cutils.c.o -c /home/git/GIT/quickjs/cutils.c
/usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/dtoa.c.o -MF CMakeFiles/qjs.dir/dtoa.c.o.d -o CMakeFiles/qjs.dir/dtoa.c.o -c /home/git/GIT/quickjs/dtoa.c
/usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/libregexp.c.o -MF CMakeFiles/qjs.dir/libregexp.c.o.d -o CMakeFiles/qjs.dir/libregexp.c.o -c /home/git/GIT/quickjs/libregexp.c
/usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/libunicode.c.o -MF CMakeFiles/qjs.dir/libunicode.c.o.d -o CMakeFiles/qjs.dir/libunicode.c.o -c /home/git/GIT/quickjs/libunicode.c
/usr/bin/i586-pc-msdosdjgpp-gcc -D_GNU_SOURCE -I/home/git/GIT/quickjs -O3 -DNDEBUG -std=gnu11 -Wall -Wextra -Wformat=2 -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-stringop-truncation -Wno-array-bounds -funsigned-char -MD -MT CMakeFiles/qjs.dir/quickjs.c.o -MF CMakeFiles/qjs.dir/quickjs.c.o.d -o CMakeFiles/qjs.dir/quickjs.c.o -c /home/git/GIT/quickjs/quickjs.c
/usr/bin/i586-pc-msdosdjgpp-ar qc libqjs.a CMakeFiles/qjs.dir/cutils.c.o CMakeFiles/qjs.dir/dtoa.c.o CMakeFiles/qjs.dir/libregexp.c.o CMakeFiles/qjs.dir/libunicode.c.o CMakeFiles/qjs.dir/quickjs.c.o
/usr/bin/ranlib libqjs.a