Skip to content

Commit e2b05aa

Browse files
committed
fbc: use clang as the default backend on darwin
Clang is the default C compiler on darwin. This addresses llvm bug 18658 for unused gotos and avoids any issues, using the workaround that already exists in the codebase.
1 parent 3194a9d commit e2b05aa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/compiler/fb.bi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ const FB_DEFAULT_CPUTYPE_ASMJS = FB_CPUTYPE_ASMJS
483483
#error Unsupported CPU arch
484484
#endif
485485

486-
#if defined( __FB_64BIT__ ) or (not defined( __FB_X86__ ))
486+
#if defined( __FB_DARWIN__ )
487+
const FB_DEFAULT_BACKEND = FB_BACKEND_CLANG
488+
#elseif defined( __FB_64BIT__ ) or (not defined( __FB_X86__ ))
487489
const FB_DEFAULT_BACKEND = FB_BACKEND_GCC
488490
#else
489491
const FB_DEFAULT_BACKEND = FB_BACKEND_GAS

src/compiler/fbc.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,6 +3062,9 @@ private sub hCheckArgs()
30623062
if( (fbGetCpuFamily( ) = FB_CPUFAMILY_X86) and _
30633063
(fbGetOption(FB_COMPOPT_TARGET) <> FB_COMPTARGET_DARWIN) ) then
30643064
fbSetOption( FB_COMPOPT_BACKEND, FB_BACKEND_GAS )
3065+
elseif (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DARWIN) then
3066+
'' Use clang backend by default on darwin
3067+
fbSetOption( FB_COMPOPT_BACKEND, FB_BACKEND_CLANG )
30653068
else
30663069
fbSetOption( FB_COMPOPT_BACKEND, FB_BACKEND_GCC )
30673070
end if

0 commit comments

Comments
 (0)