Re: Question on multiple compiler environment




Matthias Möller wrote:
Most compilers, especially the ones under UNIX/Linux, have
options like -v, -V or --version to print the version number to the
screen/standard output. You will then have to analyse that output.

Yes I know but nevertheless thank you for your answer. But this requires
to write some kind of script which extracts the version number from the
console output.

1. the "layout" of the console output differs from one compiler to another.

2. the "layout" may differ from one version to the other.

As a consequence, the scripts must be adapted each time a new version is
available. Isn't there a more elegant way to determine the version number?

Matthias

generally no. Some compilers might define preprocessor macros:
e.g. g95 defines
__G95__ 0
__G95_MINOR__ 50
__FORTRAN__ 95
__GNUC__ 4
so you can compile

~/g95> cat version.F90
i=__G95__ ; j=__G95_MINOR__
write(6,'(I0,A1,I0)') i,".",j
END

to get the answer.

The other approach is to have a configure step which actually executes
your compiler on a testcase with a set of flags and see if it generates
an error or not. If there is no error, you use those flags to compile
the full source, otherwise, you try the next set of flags and so on.

Joost

.



Relevant Pages

  • Re: amd64 bitops fix for -Os
    ... > kernel build. ... because its inline asm assumes at least one iteration ... the generated code is such that the flags ... although in a perfect world the compiler would be ...
    (Linux-Kernel)
  • Re: [PATCH 3/3] Enforce "unsigned long flags;" when spinlocking
    ... something different from "unsigned long flags;". ... This is a pretty ugly-looking patch. ... I want build system, compiler, headers etc to do everything against ... sparse spits warning ...
    (Linux-Kernel)
  • Re: Kernel ARCH i586 i686 - need clarification
    ... The more interesting answer will be found in the source for the kernel ... The compiler flags are interesting. ... T o m M i t c h e l l spam unwanted email. ...
    (Fedora)
  • Re: Open Source EC++ Implementation?
    ... compiler anyway, so optimisation will be very similar. ... My idea is if I use these two flags, then the size of generated code ... But exception *propagation* can require overhead in the generated code - a function that calls another function must be able to pass exceptions back up the chain, even if it does not use exceptions itself. ... Thus you have one less problem to worry about there (assuming you use avrgcc - I don't know how things stand with something like IAR's AVR C++ compiler). ...
    (comp.arch.embedded)
  • Re: Simulating the button click event programatically ....
    ... they don't affect the expression's meaning to the compiler. ... cannot both care and not care to know the answer. ... instructions. ... Then various CPU flags are set according to the result, ...
    (comp.lang.pascal.delphi.misc)