Hi, because Win-XP did not flushed the buffer the last version was wrong; the actual version is: // compiler autodetection # ifdef COMPILER_OK # undef COMPILER_OK # endif # ifdef __IAR_SYSTEMS_ICC__ /* This is an IAR Compiler. */ # if (((__TID__ >> 8) & 0x7f) == 43) /* This is the IAR MSP430 compiler. */ # define IAR # if (__VER__ < 200) /* V1.xx of the compiler. */ # define IARV1 # define COMPILER_OK # else # if (__VER__ < 300) /* V2.xx of the compiler. */ # define IARV2 # else # if (__VER__ < 400) /* V3.xx of the compiler. */ # define IARV3 # endif # endif # endif # endif # if (((__TID__ >> 8) & 0x7f) == 45) /* This is the IAR CR16C compiler. */ # error "No MSP430 compiler." # else # if (((__TID__ >> 8) & 0x7f) == 85) /* This is the IAR V850 compiler. */ # error "No MSP430 compiler." # else /* Unknown IAR compiler. */ # endif # endif /* This is not an IAR compiler. */ # else # if defined(MSP430) && defined(__MSP430__) /* MSPGCC */ # define MSPGCC # define COMPILER_OK # /* MCU check */ // #ifndef __MSP430_W427__ // # error "Wrong MCU." // #endif # # else /* No IAR compiler, no MSPGCC */ # error "Unknown compiler/preprocessor." # endif # endif /* End compiler autodetection */ Rolf
Compiler autodetection?
Started by ●April 22, 2004
Reply by ●April 22, 20042004-04-22
Reply by ●April 22, 20042004-04-22
For AQ430, the mnemonic is: __AQCOMPILER__ It is defined automatically inside the compiler, so there is no need to include any special .h file: #ifdef __AQCOMPILER__ .... #endif Michel --- In msp430@msp4..., "Rolf F." <rolf.freitag@d...> wrote: > Hi, > > i'm using defines and ifs/elses for compiling with different compilers > and to automatize this i'm looking for compiler (or preprocessor) > dependent defines . > Does someone has a list of macros/functions or something else which is > only availible with one compiler/preprocessor? > > Rolf
Reply by ●April 22, 20042004-04-22
Hi!
> the actual version is:
> # else
> # if defined(MSP430) && defined(__MSP430__)
> /* MSPGCC */
> # define MSPGCC
> # define COMPILER_OK
May I suggest that you add "defined(__GNUC__)" to this test as well?
(This symbol is defined by all gcc variants, as far as I know.)
Both the symbol MSP430 and __MSP430__ are generic and may very well be
defined by other (present or future) compilers, in which case you will
mistake them for GCC.
-- Anders
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Reply by ●April 22, 20042004-04-22
You are right, I found this faq right now: http://mspgcc.sourceforge.net/faq/x55.html Thanks, Patrik --- In msp430@msp4..., Anders Lindgren <andersl@i...> wrote: > > Hi! > > > the actual version is: > > # else > > # if defined(MSP430) && defined(__MSP430__) > > /* MSPGCC */ > > # define MSPGCC > > # define COMPILER_OK > > May I suggest that you add "defined(__GNUC__)" to this test as well? > (This symbol is defined by all gcc variants, as far as I know.) > > Both the symbol MSP430 and __MSP430__ are generic and may very well be > defined by other (present or future) compilers, in which case you will > mistake them for GCC. > > -- Anders > -- > Disclaimer: Opinions expressed in this posting are strictly my own and > not necessarily those of my employer.
Reply by ●April 22, 20042004-04-22
Hi,
ok, now i'm using this version (for IAR 1x and mspgcc):
// compiler autodetection
# ifdef COMPILER_OK
# undef COMPILER_OK
# endif
# ifdef __IAR_SYSTEMS_ICC__
/* This is an IAR Compiler. */
# if (((__TID__ >> 8) & 0x7f) == 43)
/* This is the IAR MSP430 compiler. */
# define IAR
# if (__VER__ < 200)
/* V1.xx of the compiler. */
# define IARV1
# define COMPILER_OK
# else
# if (__VER__ < 300)
/* V2.xx of the compiler. */
# define IARV2
# else
# if (__VER__ < 400)
/* V3.xx of the compiler. */
# define IARV3
# endif
# endif
# endif
# endif
# if (((__TID__ >> 8) & 0x7f) == 45)
/* This is the IAR CR16C compiler. */
# error "No MSP430 compiler."
# else
# if (((__TID__ >> 8) & 0x7f) == 85)
/* This is the IAR V850 compiler. */
# error "No MSP430 compiler."
# else
/* Unknown IAR compiler. */
# endif
# endif
/* not IAR: */
# else
# if defined(MSP430) && defined(__MSP430__) &&
defined(__GNUC__)
/* MSPGCC */
# define MSPGCC
# define COMPILER_OK
#
/* MCU check */
// #ifndef __MSP430_W427__
// # error "Wrong MCU."
// #endif
#
/* not IAR, not MSPGCC: */
# else
# ifdef __AQCOMPILER__
#
# endif
# endif /* NOT MSPGCC */
# endif /* NOT IAR */
/* final compiler check */
# ifndef COMPILER_OK
# error "Unknown or not supported compiler/preprocessor."
# endif
/* End compiler autodetection */
Rolf
Anders Lindgren schrieb:
>Hi!
>
>
>
>>the actual version is:
>># else
>># if defined(MSP430) && defined(__MSP430__)
>>/* MSPGCC */
>># define MSPGCC
>># define COMPILER_OK
>>
>>
>
>May I suggest that you add "defined(__GNUC__)" to this test as
well?
>(This symbol is defined by all gcc variants, as far as I know.)
>
>Both the symbol MSP430 and __MSP430__ are generic and may very well be
>defined by other (present or future) compilers, in which case you will
>mistake them for GCC.
>
> -- Anders
>
>
Reply by ●April 22, 20042004-04-22
Re: > i'm using defines and ifs/elses for compiling with different compilers > and to automatize this i'm looking for compiler (or preprocessor) > dependent defines . > Does someone has a list of macros/functions or something else which is > only availible with one compiler/preprocessor? Just look in Salvo's salvo.h .... Andrew Kalman aek ... at ... pumpkininc ... dot ... com