dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: Fix misuse of "target_info" in default_target_compile


From: Jacob Bachmeyer
Subject: PATCH: Fix misuse of "target_info" in default_target_compile
Date: Fri, 31 May 2019 18:21:39 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 MultiZilla/1.8.3.4e SeaMonkey/1.1.17 Mnenhy/0.7.6.0

This patch fixes an interesting bug in default_target_compile: if the options set dest= prior to specifying a language, the language defaults are loaded incorrectly. Specifically, for each board_info value, the *existence* of that value is tested for the board specified using dest=, but the actual value is read from the information for the current target. Since the current target is the default destination, the only reason to specify the dest= option is to override the current target, so this must be wrong and this patch fixes the bug.

----
ChangeLog entry:
        * lib/target.exp (default_target_compile): Use the "board_info"
        procedure correctly when loading language defaults, instead of
        checking for each option under the $dest board, but reading the
        value using "target_info", which uses the current target instead
        of the target specified using the "dest=" option.
---
lib/target.exp |   20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/target.exp b/lib/target.exp
index a9ac83e..6a940af 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -337,10 +337,10 @@ proc default_target_compile {source destfile type 
options} {
        if { $i eq "ada" } {
            set compiler_type "ada"
            if {[board_info $dest exists adaflags]} {
-               append add_flags " [target_info adaflags]"
+               append add_flags " [board_info $dest adaflags]"
            }
            if {[board_info $dest exists gnatmake]} {
-               set compiler [target_info gnatmake]
+               set compiler [board_info $dest gnatmake]
            } else {
                set compiler [find_gnatmake]
            }
@@ -349,11 +349,11 @@ proc default_target_compile {source destfile type 
options} {
        if { $i eq "c++" } {
            set compiler_type "c++"
            if {[board_info $dest exists cxxflags]} {
-               append add_flags " [target_info cxxflags]"
+               append add_flags " [board_info $dest cxxflags]"
            }
            append add_flags " [g++_include_flags]"
            if {[board_info $dest exists c++compiler]} {
-               set compiler [target_info c++compiler]
+               set compiler [board_info $dest c++compiler]
            } else {
                set compiler [find_g++]
            }
@@ -362,10 +362,10 @@ proc default_target_compile {source destfile type 
options} {
        if { $i eq "d" } {
            set compiler_type "d"
            if {[board_info $dest exists dflags]} {
-               append add_flags " [target_info dflags]"
+               append add_flags " [board_info $dest dflags]"
            }
            if {[board_info $dest exists dcompiler]} {
-               set compiler [target_info dcompiler]
+               set compiler [board_info $dest dcompiler]
            } else {
                set compiler [find_gdc]
            }
@@ -374,10 +374,10 @@ proc default_target_compile {source destfile type 
options} {
        if { $i eq "f77" } {
            set compiler_type "f77"
            if {[board_info $dest exists f77flags]} {
-               append add_flags " [target_info f77flags]"
+               append add_flags " [board_info $dest f77flags]"
            }
            if {[board_info $dest exists f77compiler]} {
-               set compiler [target_info f77compiler]
+               set compiler [board_info $dest f77compiler]
            } else {
                set compiler [find_g77]
            }
@@ -386,10 +386,10 @@ proc default_target_compile {source destfile type 
options} {
        if { $i eq "f90" } {
            set compiler_type "f90"
            if {[board_info $dest exists f90flags]} {
-               append add_flags " [target_info f90flags]"
+               append add_flags " [board_info $dest f90flags]"
            }
            if {[board_info $dest exists f90compiler]} {
-               set compiler [target_info f90compiler]
+               set compiler [board_info $dest f90compiler]
            } else {
                set compiler [find_gfortran]
            }
----


-- Jacob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]