1# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program; if not, write to the Free Software 15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 17# Please email any bugs, comments, and/or additions to this file to: 18# gcc-patches@gcc.gnu.org 19 20# Globals. 21 22global compat_use_alt 23global compat_same_alt 24global compat_have_dfp 25global compat_skip_list 26 27# This file defines procs for determining features supported by both C 28# compilers for compatibility tests. 29 30load_lib target-supports.exp 31 32# 33# compat-use-alt-compiler -- make the alternate compiler the default 34# 35proc compat-use-alt-compiler { } { 36 global GCC_UNDER_TEST ALT_CC_UNDER_TEST 37 global compat_same_alt 38 39 # We don't need to do this if the alternate compiler is actually 40 # the same as the compiler under test. 41 if { $compat_same_alt == 0 } then { 42 set GCC_UNDER_TEST $ALT_CC_UNDER_TEST 43 } 44} 45 46# 47# compat-use-tst-compiler -- make compiler under test the default 48# 49proc compat-use-tst-compiler { } { 50 global GCC_UNDER_TEST compat_save_gcc_under_test 51 global compat_same_alt 52 53 # We don't need to do this if the alternate compiler is actually 54 # the same as the compiler under test. 55 56 if { $compat_same_alt == 0 } then { 57 set GCC_UNDER_TEST $compat_save_gcc_under_test 58 } 59} 60 61# Find out whether both compilers support decimal float types. 62proc compat_setup_dfp { } { 63 global compat_use_alt 64 global compat_same_alt 65 global compat_have_dfp 66 67 verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2 68 set compat_have_dfp 1 69 # If there is an alternate compiler, does it support decimal float types? 70 if { $compat_use_alt == 1 && $compat_same_alt == 0 } { 71 compat-use-alt-compiler 72 set compat_have_dfp [check_effective_target_dfprt_nocache] 73 compat-use-tst-compiler 74 verbose "compat_have_dfp for alt compiler: $compat_have_dfp" 2 75 } 76 # Does the compiler under test support it? 77 if { $compat_have_dfp == 1 } { 78 set compat_have_dfp [check_effective_target_dfprt_nocache] 79 verbose "compat_have_dfp for tst compiler: $compat_have_dfp" 2 80 } 81 82 # If decimal float is not supported, add it to the skip list, which 83 # affects code in the header files. 84 if { $compat_have_dfp == 0 } { 85 global compat_skip_list 86 lappend compat_skip_list "DECIMAL_FLOAT" 87 } 88} 89 90# If either compiler does not support decimal float types, skip this test. 91 92proc dg-require-compat-dfp { args } { 93 global compat_have_dfp 94 if { $compat_have_dfp == 0 } { 95 upvar dg-do-what dg-do-what 96 set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] 97 } 98} 99