Changes required to compile Racket with C99+exts (#3497)

With these changes RacketCS and RacketBC can be compiled with:
     `-std=c99 -D_DEFAULT_SOURCE`

Also added some documentation on contribution guidelines.
This commit is contained in:
Paulo Matos 2020-11-13 19:34:12 +01:00 committed by GitHub
parent 83e256cce6
commit 355d384e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 7 deletions

View File

@ -182,6 +182,13 @@ make that process faster by keeping a few guidelines in mind:
will only be detected by a full @exec{raco setup}. will only be detected by a full @exec{raco setup}.
@italic{Really:} run @exec{raco setup}.} @italic{Really:} run @exec{raco setup}.}
@item{For changes to the C code, ensure your code follows the C99 standard.
On *nix systems, extensions that are part of the @exec{_DEFAULT_SOURCE}
pre-processor flag are also allowed. See the
@hyperlink[https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fDEFAULT_005fSOURCE]{glibc}
manual for more details.}
] ]
@; ------------------------------------------------------------ @; ------------------------------------------------------------

View File

@ -864,11 +864,11 @@ void scheme_future_block_until_gc()
# endif # endif
int _eax, _ebx, _ecx, _edx, op = 0; int _eax, _ebx, _ecx, _edx, op = 0;
/* we can't always use EBX, so save and restore it: */ /* we can't always use EBX, so save and restore it: */
asm (MZ_PUSH_EBX "\n\t" __asm__ (MZ_PUSH_EBX "\n\t"
"cpuid \n\t" "cpuid \n\t"
"movl %%ebx, %1 \n\t" "movl %%ebx, %1 \n\t"
MZ_POP_EBX MZ_POP_EBX
: "=a" (_eax), "=r" (_ebx), "=c" (_ecx), "=d" (_edx) : "a" (op)); : "=a" (_eax), "=r" (_ebx), "=c" (_ecx), "=d" (_edx) : "a" (op));
} }
# undef MZ_PUSH_EBX # undef MZ_PUSH_EBX
# undef MZ_POP_EBX # undef MZ_POP_EBX

View File

@ -265,14 +265,14 @@ READ_ONLY Scheme_Object *scheme_zerol, *scheme_nzerol, *scheme_long_pi,
XFORM_NONGCING static void to_double_prec(void) XFORM_NONGCING static void to_double_prec(void)
{ {
int _dblprec = 0x27F; int _dblprec = 0x27F;
asm ("fldcw %0" : : "m" (_dblprec)); __asm__ ("fldcw %0" : : "m" (_dblprec));
} }
#endif #endif
#if defined(ASM_DBLPREC_CONTROL_87) || defined(ASM_EXTPREC_CONTROL_87) #if defined(ASM_DBLPREC_CONTROL_87) || defined(ASM_EXTPREC_CONTROL_87)
XFORM_NONGCING static void to_extended_prec(void) XFORM_NONGCING static void to_extended_prec(void)
{ {
int _extprec = 0x37F; int _extprec = 0x37F;
asm ("fldcw %0" : : "m" (_extprec)); __asm__ ("fldcw %0" : : "m" (_extprec));
} }
#endif #endif

View File

@ -12,6 +12,7 @@
# include <pwd.h> # include <pwd.h>
# include <grp.h> # include <grp.h>
# include <dirent.h> # include <dirent.h>
# include <sys/time.h>
#endif #endif
#ifdef RKTIO_SYSTEM_WINDOWS #ifdef RKTIO_SYSTEM_WINDOWS
# include <shlobj.h> # include <shlobj.h>