Add support for Bruce C Compiler (BCC)
Revise C compiler detection code to be K&R compatible.
This commit is contained in:
parent
a9cb00cd50
commit
53c0dc2dd2
|
@ -0,0 +1,4 @@
|
||||||
|
add-bruce-c
|
||||||
|
-----------
|
||||||
|
|
||||||
|
* Support was added for the Bruce C Compiler with compiler id ``Bruce``.
|
|
@ -12,6 +12,7 @@ include:
|
||||||
ADSP = Analog VisualDSP++ (analog.com)
|
ADSP = Analog VisualDSP++ (analog.com)
|
||||||
AppleClang = Apple Clang (apple.com)
|
AppleClang = Apple Clang (apple.com)
|
||||||
ARMCC = ARM Compiler (arm.com)
|
ARMCC = ARM Compiler (arm.com)
|
||||||
|
Bruce = Bruce C Compiler
|
||||||
CCur = Concurrent Fortran (ccur.com)
|
CCur = Concurrent Fortran (ccur.com)
|
||||||
Clang = LLVM Clang (clang.llvm.org)
|
Clang = LLVM Clang (clang.llvm.org)
|
||||||
Cray = Cray Compiler (cray.com)
|
Cray = Cray Compiler (cray.com)
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
#if defined(__18CXX)
|
#if defined(__18CXX)
|
||||||
# define ID_VOID_MAIN
|
# define ID_VOID_MAIN
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__CLASSIC_C__)
|
||||||
|
/* cv-qualifiers did not exist in K&R C */
|
||||||
|
# define const
|
||||||
|
# define volatile
|
||||||
|
#endif
|
||||||
|
|
||||||
@CMAKE_C_COMPILER_ID_CONTENT@
|
@CMAKE_C_COMPILER_ID_CONTENT@
|
||||||
|
|
||||||
|
@ -28,23 +33,28 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||||
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
|
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
|
||||||
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
|
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
|
||||||
|
|
||||||
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
|
#if !defined(__STDC__)
|
||||||
#if !defined(__STDC_VERSION__)
|
# define C_DIALECT
|
||||||
"90"
|
|
||||||
#elif __STDC_VERSION__ >= 201000L
|
#elif __STDC_VERSION__ >= 201000L
|
||||||
"11"
|
# define C_DIALECT "11"
|
||||||
#elif __STDC_VERSION__ >= 199901L
|
#elif __STDC_VERSION__ >= 199901L
|
||||||
"99"
|
# define C_DIALECT "99"
|
||||||
#else
|
#else
|
||||||
|
# define C_DIALECT "90"
|
||||||
#endif
|
#endif
|
||||||
"]";
|
const char* info_language_dialect_default =
|
||||||
|
"INFO" ":" "dialect_default[" C_DIALECT "]";
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef ID_VOID_MAIN
|
#ifdef ID_VOID_MAIN
|
||||||
void main() {}
|
void main() {}
|
||||||
#else
|
#else
|
||||||
|
# if defined(__CLASSIC_C__)
|
||||||
|
int main(argc, argv) int argc; char *argv[];
|
||||||
|
# else
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
# endif
|
||||||
{
|
{
|
||||||
int require = 0;
|
int require = 0;
|
||||||
require += info_compiler[argc];
|
require += info_compiler[argc];
|
||||||
|
|
|
@ -79,6 +79,7 @@ function(compiler_id_detection outvar lang)
|
||||||
if (lang STREQUAL C)
|
if (lang STREQUAL C)
|
||||||
list(APPEND ordered_compilers
|
list(APPEND ordered_compilers
|
||||||
TinyCC
|
TinyCC
|
||||||
|
Bruce
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND ordered_compilers
|
list(APPEND ordered_compilers
|
||||||
|
|
|
@ -87,6 +87,9 @@ else()
|
||||||
|
|
||||||
# Try enabling ANSI mode on HP.
|
# Try enabling ANSI mode on HP.
|
||||||
"-Aa"
|
"-Aa"
|
||||||
|
|
||||||
|
# Try compiling K&R-compatible code (needed by Bruce C Compiler).
|
||||||
|
"-D__CLASSIC_C__"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -91,11 +91,11 @@
|
||||||
# define PLATFORM_ID "Windows3x"
|
# define PLATFORM_ID "Windows3x"
|
||||||
|
|
||||||
# else /* unknown platform */
|
# else /* unknown platform */
|
||||||
# define PLATFORM_ID ""
|
# define PLATFORM_ID
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else /* unknown platform */
|
#else /* unknown platform */
|
||||||
# define PLATFORM_ID ""
|
# define PLATFORM_ID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define ARCHITECTURE_ID ""
|
# define ARCHITECTURE_ID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convert integer to decimal digit literals. */
|
/* Convert integer to decimal digit literals. */
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
set(_compiler_id_pp_test "defined(__BCC__)")
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Bruce C Compiler ignores "-g" flag and optimization cannot be
|
||||||
|
# enabled here (it is implemented only for 8086 target).
|
||||||
|
set (CMAKE_C_FLAGS_INIT "-D__CLASSIC_C__")
|
||||||
|
set (CMAKE_C_FLAGS_DEBUG_INIT "-g")
|
||||||
|
set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
|
||||||
|
set (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
|
||||||
|
set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -DNDEBUG")
|
Loading…
Reference in New Issue