xref: /openbsd-src/gnu/usr.bin/binutils/gdb/testsuite/lib/compiler.c (revision 11efff7f3ac2b3cfeff0c0cddc14294d9b3aca4f)
1b725ae77Skettenis /* This test file is part of GDB, the GNU debugger.
2b725ae77Skettenis 
3b725ae77Skettenis    Copyright 1995, 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
4b725ae77Skettenis 
5b725ae77Skettenis    This program is free software; you can redistribute it and/or modify
6b725ae77Skettenis    it under the terms of the GNU General Public License as published by
7b725ae77Skettenis    the Free Software Foundation; either version 2 of the License, or
8b725ae77Skettenis    (at your option) any later version.
9b725ae77Skettenis 
10b725ae77Skettenis    This program is distributed in the hope that it will be useful,
11b725ae77Skettenis    but WITHOUT ANY WARRANTY; without even the implied warranty of
12b725ae77Skettenis    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13b725ae77Skettenis    GNU General Public License for more details.
14b725ae77Skettenis 
15b725ae77Skettenis    You should have received a copy of the GNU General Public License
16b725ae77Skettenis    along with this program; if not, write to the Free Software
17b725ae77Skettenis    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18b725ae77Skettenis 
19*11efff7fSkettenis    */
20b725ae77Skettenis 
21b725ae77Skettenis /* Sometimes the behavior of a test depends upon the compiler used to
22b725ae77Skettenis    compile the test program.  A test script can call get_compiler_info
23b725ae77Skettenis    to figure out the compiler version and test_compiler_info to test it.
24b725ae77Skettenis 
25b725ae77Skettenis    get_compiler_info runs the preprocessor on this file and then eval's
26b725ae77Skettenis    the result.  This sets various symbols for use by test_compiler_info.
27b725ae77Skettenis 
28b725ae77Skettenis    TODO: make compiler_info a local variable for get_compiler_info and
29b725ae77Skettenis    test_compiler_info.
30b725ae77Skettenis 
31b725ae77Skettenis    TODO: all clients should use test_compiler_info and should not
32b725ae77Skettenis    use gcc_compiled, hp_cc_compiler, or hp_aCC_compiler.
33b725ae77Skettenis 
34*11efff7fSkettenis    */
35b725ae77Skettenis 
36*11efff7fSkettenis /* Note the semicolon at the end of this line.  Older versions of
37*11efff7fSkettenis    hp c++ have a bug in string preprocessing: if the last token on a
38*11efff7fSkettenis    line is a string, then the preprocessor concatenates the next line
39*11efff7fSkettenis    onto the current line and eats the newline!  That messes up TCL of
40*11efff7fSkettenis    course.  That happens with HP aC++ A.03.13, but it no longer happens
41*11efff7fSkettenis    with HP aC++ A.03.45. */
42*11efff7fSkettenis 
43*11efff7fSkettenis set compiler_info "unknown" ;
44b725ae77Skettenis 
45b725ae77Skettenis #if defined (__GNUC__)
46*11efff7fSkettenis #if defined (__GNUC_PATCHLEVEL__)
47*11efff7fSkettenis /* Only GCC versions >= 3.0 define the __GNUC_PATCHLEVEL__ macro.  */
48*11efff7fSkettenis set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -]
49b725ae77Skettenis #else
50*11efff7fSkettenis set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ "unknown"} -]
51*11efff7fSkettenis #endif
52*11efff7fSkettenis #endif
53*11efff7fSkettenis 
54*11efff7fSkettenis #if defined (__HP_CXD_SPP)
55*11efff7fSkettenis /* older hp ansi c, such as A.11.01.25171.gp, defines this */
56*11efff7fSkettenis set compiler_info [join {hpcc __HP_CXD_SPP} -]
57b725ae77Skettenis #endif
58b725ae77Skettenis 
59b725ae77Skettenis #if defined (__HP_cc)
60*11efff7fSkettenis /* newer hp ansi c, such as B.11.11.28706.gp, defines this */
61b725ae77Skettenis set compiler_info [join {hpcc __HP_cc} -]
62b725ae77Skettenis #endif
63b725ae77Skettenis 
64b725ae77Skettenis #if defined (__HP_aCC)
65b725ae77Skettenis set compiler_info [join {hpacc __HP_aCC} -]
66b725ae77Skettenis #endif
67