OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [gdb/] [testsuite/] [lib/] [cp-support.exp] - Diff between revs 157 and 223

Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
# This test code is part of GDB, the GNU debugger.
# This test code is part of GDB, the GNU debugger.
# Copyright 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
# Copyright 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
# along with this program.  If not, see .
# Auxiliary function to check for known problems.
# Auxiliary function to check for known problems.
#
#
# EXPECTED_STRING is the string expected by the test.
# EXPECTED_STRING is the string expected by the test.
#
#
# ACTUAL_STRING is the actual string output by gdb.
# ACTUAL_STRING is the actual string output by gdb.
#
#
# ERRATA_TABLE is a list of lines of the form:
# ERRATA_TABLE is a list of lines of the form:
#
#
#  { expected-string broken-string {eval-block} }
#  { expected-string broken-string {eval-block} }
#
#
# If there is a line for the given EXPECTED_STRING, and if the
# If there is a line for the given EXPECTED_STRING, and if the
# ACTUAL_STRING output by gdb is the same as the BROKEN_STRING in the
# ACTUAL_STRING output by gdb is the same as the BROKEN_STRING in the
# table, then I eval the eval-block.
# table, then I eval the eval-block.
proc cp_check_errata { expected_string actual_string errata_table } {
proc cp_check_errata { expected_string actual_string errata_table } {
    foreach erratum $errata_table {
    foreach erratum $errata_table {
        if { "$expected_string" == [lindex $erratum 0]
        if { "$expected_string" == [lindex $erratum 0]
        &&   "$actual_string"   == [lindex $erratum 1] } then {
        &&   "$actual_string"   == [lindex $erratum 1] } then {
            eval [lindex $erratum 2]
            eval [lindex $erratum 2]
        }
        }
    }
    }
}
}
# Test ptype of a class.
# Test ptype of a class.
#
#
# Different C++ compilers produce different output.  To accommodate all
# Different C++ compilers produce different output.  To accommodate all
# the variations listed below, I read the output of "ptype" and process
# the variations listed below, I read the output of "ptype" and process
# each line, matching it to the class description given in the
# each line, matching it to the class description given in the
# parameters.
# parameters.
#
#
# IN_COMMAND and IN_TESTNAME are the command and testname for
# IN_COMMAND and IN_TESTNAME are the command and testname for
# gdb_test_multiple.  If IN_TESTNAME is the empty string, then it
# gdb_test_multiple.  If IN_TESTNAME is the empty string, then it
# defaults to IN_COMMAND.
# defaults to IN_COMMAND.
#
#
# IN_KEY is "class" or "struct".  For now, I ignore it, and allow either
# IN_KEY is "class" or "struct".  For now, I ignore it, and allow either
# "class" or "struct" in the output, as long as the access specifiers all
# "class" or "struct" in the output, as long as the access specifiers all
# work out okay.
# work out okay.
#
#
# IN_TAG is the class tag or structure tag.
# IN_TAG is the class tag or structure tag.
#
#
# IN_CLASS_TABLE is a list of class information.  Each entry contains a
# IN_CLASS_TABLE is a list of class information.  Each entry contains a
# keyword and some values.  The keywords and their values are:
# keyword and some values.  The keywords and their values are:
#
#
#   { base "base-declaration" }
#   { base "base-declaration" }
#
#
#      the class has a base with the given declaration.
#      the class has a base with the given declaration.
#
#
#   { vbase "name" }
#   { vbase "name" }
#
#
#      the class has a virtual base pointer with the given name.  this
#      the class has a virtual base pointer with the given name.  this
#      is for gcc 2.95.3, which emits ptype entries for the virtual base
#      is for gcc 2.95.3, which emits ptype entries for the virtual base
#      pointers.  the vbase list includes both indirect and direct
#      pointers.  the vbase list includes both indirect and direct
#      virtual base classes (indeed, a virtual base is usually
#      virtual base classes (indeed, a virtual base is usually
#      indirect), so this information cannot be derived from the base
#      indirect), so this information cannot be derived from the base
#      declarations.
#      declarations.
#
#
#   { field "access" "declaration" }
#   { field "access" "declaration" }
#
#
#      the class has a data field with the given access type and the
#      the class has a data field with the given access type and the
#      given declaration.
#      given declaration.
#
#
#   { method "access" "declaration" }
#   { method "access" "declaration" }
#
#
#      the class has a member function with the given access type
#      the class has a member function with the given access type
#      and the given declaration.
#      and the given declaration.
#
#
# If you test the same class declaration more than once, you can specify
# If you test the same class declaration more than once, you can specify
# IN_CLASS_TABLE as "ibid".  "ibid" means: look for a previous class
# IN_CLASS_TABLE as "ibid".  "ibid" means: look for a previous class
# table that had the same IN_KEY and IN_TAG, and re-use that table.
# table that had the same IN_KEY and IN_TAG, and re-use that table.
#
#
# IN_TAIL is the expected text after the close brace, specifically the "*"
# IN_TAIL is the expected text after the close brace, specifically the "*"
# in "struct { ... } *".  This is an optional parameter.  The default
# in "struct { ... } *".  This is an optional parameter.  The default
# value is "", for no tail.
# value is "", for no tail.
#
#
# IN_ERRATA_TABLE is a list of errata entries.  See cp_check_errata for the
# IN_ERRATA_TABLE is a list of errata entries.  See cp_check_errata for the
# format of the errata table.  Note: the errata entries are not subject to
# format of the errata table.  Note: the errata entries are not subject to
# demangler syntax adjustment, so you have to make a bigger table
# demangler syntax adjustment, so you have to make a bigger table
# with lines for each output variation.
# with lines for each output variation.
#
#
# gdb can vary the output of ptype in several ways:
# gdb can vary the output of ptype in several ways:
#
#
# . CLASS/STRUCT
# . CLASS/STRUCT
#
#
#   The output can start with either "class" or "struct", depending on
#   The output can start with either "class" or "struct", depending on
#   what the symbol table reader in gdb decides.  This is usually
#   what the symbol table reader in gdb decides.  This is usually
#   unrelated to the original source code.
#   unrelated to the original source code.
#
#
#     dwarf-2  debug info distinguishes class/struct, but gdb ignores it
#     dwarf-2  debug info distinguishes class/struct, but gdb ignores it
#     stabs+   debug info does not distinguish class/struct
#     stabs+   debug info does not distinguish class/struct
#     hp       debug info distinguishes class/struct, and gdb honors it
#     hp       debug info distinguishes class/struct, and gdb honors it
#
#
#   I tried to accommodate this with regular expressions such as
#   I tried to accommodate this with regular expressions such as
#   "((class|struct) A \{ public:|struct A \{)", but that turns into a
#   "((class|struct) A \{ public:|struct A \{)", but that turns into a
#   hairy mess because of optional private virtual base pointers and
#   hairy mess because of optional private virtual base pointers and
#   optional public synthetic operators.  This is the big reason I gave
#   optional public synthetic operators.  This is the big reason I gave
#   up on regular expressions and started parsing the output.
#   up on regular expressions and started parsing the output.
#
#
# . REDUNDANT ACCESS SPECIFIER
# . REDUNDANT ACCESS SPECIFIER
#
#
#   In "class { private: ... }" or "struct { public: ... }", gdb might
#   In "class { private: ... }" or "struct { public: ... }", gdb might
#   or might not emit a redundant initial access specifier, depending
#   or might not emit a redundant initial access specifier, depending
#   on the gcc version.
#   on the gcc version.
#
#
# . VIRTUAL BASE POINTERS
# . VIRTUAL BASE POINTERS
#
#
#   If a class has virtual bases, either direct or indirect, the class
#   If a class has virtual bases, either direct or indirect, the class
#   will have virtual base pointers.  With gcc 2.95.3, gdb prints lines
#   will have virtual base pointers.  With gcc 2.95.3, gdb prints lines
#   for these virtual base pointers.  This does not happen with gcc
#   for these virtual base pointers.  This does not happen with gcc
#   3.3.4, gcc 3.4.1, or hp acc A.03.45.
#   3.3.4, gcc 3.4.1, or hp acc A.03.45.
#
#
#   I accept these lines.  These lines are optional; but if I see one of
#   I accept these lines.  These lines are optional; but if I see one of
#   these lines, then I expect to see all of them.
#   these lines, then I expect to see all of them.
#
#
#   Note: drow considers printing these lines to be a bug in gdb.
#   Note: drow considers printing these lines to be a bug in gdb.
#
#
# . SYNTHETIC METHODS
# . SYNTHETIC METHODS
#
#
#   A C++ compiler may synthesize some methods: an assignment
#   A C++ compiler may synthesize some methods: an assignment
#   operator, a copy constructor, a constructor, and a destructor.  The
#   operator, a copy constructor, a constructor, and a destructor.  The
#   compiler might include debug information for these methods.
#   compiler might include debug information for these methods.
#
#
#     dwarf-2  gdb does not show these methods
#     dwarf-2  gdb does not show these methods
#     stabs+   gdb shows these methods
#     stabs+   gdb shows these methods
#     hp       gdb does not show these methods
#     hp       gdb does not show these methods
#
#
#   I accept these methods.  These lines are optional, and any or
#   I accept these methods.  These lines are optional, and any or
#   all of them might appear, mixed in anywhere in the regular methods.
#   all of them might appear, mixed in anywhere in the regular methods.
#
#
#   With gcc v2, the synthetic copy-ctor and ctor have an additional
#   With gcc v2, the synthetic copy-ctor and ctor have an additional
#   "int" parameter at the beginning, the "in-charge" flag.
#   "int" parameter at the beginning, the "in-charge" flag.
#
#
# . DEMANGLER SYNTAX VARIATIONS
# . DEMANGLER SYNTAX VARIATIONS
#
#
#   Different demanglers produce "int foo(void)" versus "int foo()",
#   Different demanglers produce "int foo(void)" versus "int foo()",
#   "const A&" versus "const A &", and so on.
#   "const A&" versus "const A &", and so on.
#
#
# TESTED WITH
# TESTED WITH
#
#
#   gcc 2.95.3 -gdwarf-2
#   gcc 2.95.3 -gdwarf-2
#   gcc 2.95.3 -gstabs+
#   gcc 2.95.3 -gstabs+
#   gcc 3.3.4 -gdwarf-2
#   gcc 3.3.4 -gdwarf-2
#   gcc 3.3.4 -gstabs+
#   gcc 3.3.4 -gstabs+
#   gcc 3.4.1 -gdwarf-2
#   gcc 3.4.1 -gdwarf-2
#   gcc 3.4.1 -gstabs+
#   gcc 3.4.1 -gstabs+
#   gcc HEAD 20040731 -gdwarf-2
#   gcc HEAD 20040731 -gdwarf-2
#   gcc HEAD 20040731 -gstabs+
#   gcc HEAD 20040731 -gstabs+
#
#
# TODO
# TODO
#
#
# Tagless structs.
# Tagless structs.
#
#
# "A*" versus "A *" and "A&" versus "A &" in user methods.
# "A*" versus "A *" and "A&" versus "A &" in user methods.
#
#
# Test with hp ACC.
# Test with hp ACC.
#
#
# -- chastain 2004-08-07
# -- chastain 2004-08-07
proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } } {
proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } } {
    global gdb_prompt
    global gdb_prompt
    set wsopt "\[\r\n\t \]*"
    set wsopt "\[\r\n\t \]*"
    # The test name defaults to the command.
    # The test name defaults to the command.
    if { "$in_testname" == "" } then { set in_testname "$in_command" }
    if { "$in_testname" == "" } then { set in_testname "$in_command" }
    # Save class tables in a history array for reuse.
    # Save class tables in a history array for reuse.
    global cp_class_table_history
    global cp_class_table_history
    if { $in_class_table == "ibid" } then {
    if { $in_class_table == "ibid" } then {
        if { ! [info exists cp_class_table_history("$in_key,$in_tag") ] } then {
        if { ! [info exists cp_class_table_history("$in_key,$in_tag") ] } then {
            fail "$in_testname // bad ibid"
            fail "$in_testname // bad ibid"
            return
            return
        }
        }
        set in_class_table $cp_class_table_history("$in_key,$in_tag")
        set in_class_table $cp_class_table_history("$in_key,$in_tag")
    } else {
    } else {
        set cp_class_table_history("$in_key,$in_tag") $in_class_table
        set cp_class_table_history("$in_key,$in_tag") $in_class_table
    }
    }
    # Split the class table into separate tables.
    # Split the class table into separate tables.
    set list_bases   { }
    set list_bases   { }
    set list_vbases  { }
    set list_vbases  { }
    set list_fields  { }
    set list_fields  { }
    set list_methods { }
    set list_methods { }
    foreach class_line $in_class_table {
    foreach class_line $in_class_table {
        switch [lindex $class_line 0] {
        switch [lindex $class_line 0] {
            "base"   { lappend list_bases   [lindex $class_line 1] }
            "base"   { lappend list_bases   [lindex $class_line 1] }
            "vbase"  { lappend list_vbases  [lindex $class_line 1] }
            "vbase"  { lappend list_vbases  [lindex $class_line 1] }
            "field"  { lappend list_fields  [lrange $class_line 1 2] }
            "field"  { lappend list_fields  [lrange $class_line 1 2] }
            "method" { lappend list_methods [lrange $class_line 1 2] }
            "method" { lappend list_methods [lrange $class_line 1 2] }
            default  { fail "$in_testname // bad line in class table: $class_line"; return; }
            default  { fail "$in_testname // bad line in class table: $class_line"; return; }
        }
        }
    }
    }
    # Construct a list of synthetic operators.
    # Construct a list of synthetic operators.
    # These are: { count ccess-type regular-expression }.
    # These are: { count ccess-type regular-expression }.
    set list_synth { }
    set list_synth { }
    lappend list_synth [list 0 "public" "$in_tag & operator=\\($in_tag const ?&\\);"]
    lappend list_synth [list 0 "public" "$in_tag & operator=\\($in_tag const ?&\\);"]
    lappend list_synth [list 0 "public" "$in_tag\\((int,|) ?$in_tag const ?&\\);"]
    lappend list_synth [list 0 "public" "$in_tag\\((int,|) ?$in_tag const ?&\\);"]
    lappend list_synth [list 0 "public" "$in_tag\\((int|void|)\\);"]
    lappend list_synth [list 0 "public" "$in_tag\\((int|void|)\\);"]
    # Actually do the ptype.
    # Actually do the ptype.
    set parse_okay 0
    set parse_okay 0
    gdb_test_multiple "$in_command" "$in_testname // parse failed" {
    gdb_test_multiple "$in_command" "$in_testname // parse failed" {
        -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" {
        -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" {
            set parse_okay          1
            set parse_okay          1
            set actual_key          $expect_out(1,string)
            set actual_key          $expect_out(1,string)
            set actual_tag          $expect_out(2,string)
            set actual_tag          $expect_out(2,string)
            set actual_base_string  $expect_out(3,string)
            set actual_base_string  $expect_out(3,string)
            set actual_body         $expect_out(5,string)
            set actual_body         $expect_out(5,string)
            set actual_tail         $expect_out(6,string)
            set actual_tail         $expect_out(6,string)
        }
        }
    }
    }
    if { ! $parse_okay } then { return }
    if { ! $parse_okay } then { return }
    # Check the actual key.  It would be nice to require that it match
    # Check the actual key.  It would be nice to require that it match
    # the input key, but gdb does not support that.  For now, accept any
    # the input key, but gdb does not support that.  For now, accept any
    # $actual_key as long as the access property of each field/method
    # $actual_key as long as the access property of each field/method
    # matches.
    # matches.
    switch "$actual_key" {
    switch "$actual_key" {
        "class"  { set access "private" }
        "class"  { set access "private" }
        "struct" { set access "public"  }
        "struct" { set access "public"  }
        default  {
        default  {
            cp_check_errata "class"  "$actual_key" $in_errata_table
            cp_check_errata "class"  "$actual_key" $in_errata_table
            cp_check_errata "struct" "$actual_key" $in_errata_table
            cp_check_errata "struct" "$actual_key" $in_errata_table
            fail "$in_testname // wrong key: $actual_key"
            fail "$in_testname // wrong key: $actual_key"
            return
            return
        }
        }
    }
    }
    # Check the actual tag.
    # Check the actual tag.
    if { "$actual_tag" != "$in_tag" } then {
    if { "$actual_tag" != "$in_tag" } then {
        cp_check_errata "$in_tag" "$actual_tag" $in_errata_table
        cp_check_errata "$in_tag" "$actual_tag" $in_errata_table
        fail "$in_testname // wrong tag: $actual_tag"
        fail "$in_testname // wrong tag: $actual_tag"
        return
        return
    }
    }
    # Check the actual bases.
    # Check the actual bases.
    # First parse them into a list.
    # First parse them into a list.
    set list_actual_bases { }
    set list_actual_bases { }
    if { "$actual_base_string" != "" } then {
    if { "$actual_base_string" != "" } then {
        regsub "^:${wsopt}" $actual_base_string "" actual_base_string
        regsub "^:${wsopt}" $actual_base_string "" actual_base_string
        set list_actual_bases [split $actual_base_string ","]
        set list_actual_bases [split $actual_base_string ","]
    }
    }
    # Check the base count.
    # Check the base count.
    if { [llength $list_actual_bases] < [llength $list_bases] } then {
    if { [llength $list_actual_bases] < [llength $list_bases] } then {
        fail "$in_testname // too few bases"
        fail "$in_testname // too few bases"
        return
        return
    }
    }
    if { [llength $list_actual_bases] > [llength $list_bases] } then {
    if { [llength $list_actual_bases] > [llength $list_bases] } then {
        fail "$in_testname // too many bases"
        fail "$in_testname // too many bases"
        return
        return
    }
    }
    # Check each base.
    # Check each base.
    foreach actual_base $list_actual_bases {
    foreach actual_base $list_actual_bases {
        set actual_base [string trim $actual_base]
        set actual_base [string trim $actual_base]
        set base [lindex $list_bases 0]
        set base [lindex $list_bases 0]
        if { "$actual_base" != "$base" } then {
        if { "$actual_base" != "$base" } then {
            cp_check_errata "$base" "$actual_base" $in_errata_table
            cp_check_errata "$base" "$actual_base" $in_errata_table
            fail "$in_testname // wrong base: $actual_base"
            fail "$in_testname // wrong base: $actual_base"
            return
            return
        }
        }
        set list_bases [lreplace $list_bases 0 0]
        set list_bases [lreplace $list_bases 0 0]
    }
    }
    # Parse each line in the body.
    # Parse each line in the body.
    set last_was_access 0
    set last_was_access 0
    set vbase_match 0
    set vbase_match 0
    foreach actual_line [split $actual_body "\r\n"] {
    foreach actual_line [split $actual_body "\r\n"] {
        # Chomp the line.
        # Chomp the line.
        set actual_line [string trim $actual_line]
        set actual_line [string trim $actual_line]
        if { "$actual_line" == "" } then { continue }
        if { "$actual_line" == "" } then { continue }
        # Access specifiers.
        # Access specifiers.
        if { [regexp "^(public|protected|private)${wsopt}:\$" "$actual_line" s0 s1] } then {
        if { [regexp "^(public|protected|private)${wsopt}:\$" "$actual_line" s0 s1] } then {
            set access "$s1"
            set access "$s1"
            if { $last_was_access } then {
            if { $last_was_access } then {
                fail "$in_testname // redundant access specifier"
                fail "$in_testname // redundant access specifier"
                return
                return
            }
            }
            set last_was_access 1
            set last_was_access 1
            continue
            continue
        } else {
        } else {
            set last_was_access 0
            set last_was_access 0
        }
        }
        # Optional virtual base pointer.
        # Optional virtual base pointer.
        if { [ llength $list_vbases ] > 0 } then {
        if { [ llength $list_vbases ] > 0 } then {
            set vbase [lindex $list_vbases 0]
            set vbase [lindex $list_vbases 0]
            if { [ regexp "$vbase \\*(_vb.|_vb\\\$|__vb_)\[0-9\]*$vbase;" $actual_line ] } then {
            if { [ regexp "$vbase \\*(_vb.|_vb\\\$|__vb_)\[0-9\]*$vbase;" $actual_line ] } then {
                if { "$access" != "private" } then {
                if { "$access" != "private" } then {
                    cp_check_errata "private" "$access" $in_errata_table
                    cp_check_errata "private" "$access" $in_errata_table
                    fail "$in_testname // wrong access specifier for virtual base: $access"
                    fail "$in_testname // wrong access specifier for virtual base: $access"
                    return
                    return
                }
                }
                set list_vbases [lreplace $list_vbases 0 0]
                set list_vbases [lreplace $list_vbases 0 0]
                set vbase_match 1
                set vbase_match 1
                continue
                continue
            }
            }
        }
        }
        # Data field.
        # Data field.
        if { [llength $list_fields] > 0 } then {
        if { [llength $list_fields] > 0 } then {
            set field_access [lindex [lindex $list_fields 0] 0]
            set field_access [lindex [lindex $list_fields 0] 0]
            set field_decl   [lindex [lindex $list_fields 0] 1]
            set field_decl   [lindex [lindex $list_fields 0] 1]
            if { "$actual_line" == "$field_decl" } then {
            if { "$actual_line" == "$field_decl" } then {
                if { "$access" != "$field_access" } then {
                if { "$access" != "$field_access" } then {
                    cp_check_errata "$field_access" "$access" $in_errata_table
                    cp_check_errata "$field_access" "$access" $in_errata_table
                    fail "$in_testname // wrong access specifier for field: $access"
                    fail "$in_testname // wrong access specifier for field: $access"
                    return
                    return
                }
                }
                set list_fields [lreplace $list_fields 0 0]
                set list_fields [lreplace $list_fields 0 0]
                continue
                continue
            }
            }
            # Data fields must appear before synths and methods.
            # Data fields must appear before synths and methods.
            cp_check_errata "$field_decl" "$actual_line" $in_errata_table
            cp_check_errata "$field_decl" "$actual_line" $in_errata_table
            fail "$in_testname // unrecognized line type 1: $actual_line"
            fail "$in_testname // unrecognized line type 1: $actual_line"
            return
            return
        }
        }
        # Method function.
        # Method function.
        if { [llength $list_methods] > 0 } then {
        if { [llength $list_methods] > 0 } then {
            set method_access [lindex [lindex $list_methods 0] 0]
            set method_access [lindex [lindex $list_methods 0] 0]
            set method_decl   [lindex [lindex $list_methods 0] 1]
            set method_decl   [lindex [lindex $list_methods 0] 1]
            if { "$actual_line" == "$method_decl" } then {
            if { "$actual_line" == "$method_decl" } then {
                if { "$access" != "$method_access" } then {
                if { "$access" != "$method_access" } then {
                    cp_check_errata "$method_access" "$access" $in_errata_table
                    cp_check_errata "$method_access" "$access" $in_errata_table
                    fail "$in_testname // wrong access specifier for method: $access"
                    fail "$in_testname // wrong access specifier for method: $access"
                    return
                    return
                }
                }
                set list_methods [lreplace $list_methods 0 0]
                set list_methods [lreplace $list_methods 0 0]
                continue
                continue
            }
            }
            # gcc 2.95.3 shows "foo()" as "foo(void)".
            # gcc 2.95.3 shows "foo()" as "foo(void)".
            regsub -all "\\(\\)" $method_decl "(void)" method_decl
            regsub -all "\\(\\)" $method_decl "(void)" method_decl
            if { "$actual_line" == "$method_decl" } then {
            if { "$actual_line" == "$method_decl" } then {
                if { "$access" != "$method_access" } then {
                if { "$access" != "$method_access" } then {
                    cp_check_errata "$method_access" "$access" $in_errata_table
                    cp_check_errata "$method_access" "$access" $in_errata_table
                    fail "$in_testname // wrong access specifier for method: $access"
                    fail "$in_testname // wrong access specifier for method: $access"
                    return
                    return
                }
                }
                set list_methods [lreplace $list_methods 0 0]
                set list_methods [lreplace $list_methods 0 0]
                continue
                continue
            }
            }
        }
        }
        # Synthetic operators.  These are optional and can be mixed in
        # Synthetic operators.  These are optional and can be mixed in
        # with the methods in any order, but duplicates are wrong.
        # with the methods in any order, but duplicates are wrong.
        #
        #
        # This test must come after the user methods, so that a user
        # This test must come after the user methods, so that a user
        # method which matches a synth-method pattern is treated
        # method which matches a synth-method pattern is treated
        # properly as a user method.
        # properly as a user method.
        set synth_match 0
        set synth_match 0
        for { set isynth 0 } { $isynth < [llength $list_synth] } { incr isynth } {
        for { set isynth 0 } { $isynth < [llength $list_synth] } { incr isynth } {
            set synth         [lindex $list_synth $isynth]
            set synth         [lindex $list_synth $isynth]
            set synth_count   [lindex $synth 0]
            set synth_count   [lindex $synth 0]
            set synth_access  [lindex $synth 1]
            set synth_access  [lindex $synth 1]
            set synth_re      [lindex $synth 2]
            set synth_re      [lindex $synth 2]
            if { [ regexp "$synth_re" "$actual_line" ] } then {
            if { [ regexp "$synth_re" "$actual_line" ] } then {
                if { "$access" != "$synth_access" } then {
                if { "$access" != "$synth_access" } then {
                    cp_check_errata "$synth_access" "$access" $in_errata_table
                    cp_check_errata "$synth_access" "$access" $in_errata_table
                    fail "$in_testname // wrong access specifier for synthetic operator: $access"
                    fail "$in_testname // wrong access specifier for synthetic operator: $access"
                    return
                    return
                }
                }
                if { $synth_count > 0 } then {
                if { $synth_count > 0 } then {
                    cp_check_errata "$actual_line" "$actual_line" $in_errata_table
                    cp_check_errata "$actual_line" "$actual_line" $in_errata_table
                    fail "$in_testname // duplicate synthetic operator: $actual_line"
                    fail "$in_testname // duplicate synthetic operator: $actual_line"
                }
                }
                # Update the count in list_synth.
                # Update the count in list_synth.
                incr synth_count
                incr synth_count
                set synth [list $synth_count $synth_access "$synth_re"]
                set synth [list $synth_count $synth_access "$synth_re"]
                set list_synth [lreplace $list_synth $isynth $isynth $synth]
                set list_synth [lreplace $list_synth $isynth $isynth $synth]
                # Match found.
                # Match found.
                set synth_match 1
                set synth_match 1
                break
                break
            }
            }
        }
        }
        if { $synth_match } then { continue }
        if { $synth_match } then { continue }
        # Unrecognized line.
        # Unrecognized line.
        if { [llength $list_methods] > 0 } then {
        if { [llength $list_methods] > 0 } then {
            set method_decl [lindex [lindex $list_methods 0] 1]
            set method_decl [lindex [lindex $list_methods 0] 1]
            cp_check_errata "$method_decl" "$actual_line" $in_errata_table
            cp_check_errata "$method_decl" "$actual_line" $in_errata_table
        }
        }
        fail "$in_testname // unrecognized line type 2: $actual_line"
        fail "$in_testname // unrecognized line type 2: $actual_line"
        return
        return
    }
    }
    # Check for missing elements.
    # Check for missing elements.
    if { $vbase_match } then {
    if { $vbase_match } then {
        if { [llength $list_vbases] > 0 } then {
        if { [llength $list_vbases] > 0 } then {
            fail "$in_testname // missing virtual base pointers"
            fail "$in_testname // missing virtual base pointers"
            return
            return
        }
        }
    }
    }
    if { [llength $list_fields] > 0 } then {
    if { [llength $list_fields] > 0 } then {
        fail "$in_testname // missing fields"
        fail "$in_testname // missing fields"
        return
        return
    }
    }
    if { [llength $list_methods] > 0 } then {
    if { [llength $list_methods] > 0 } then {
        fail "$in_testname // missing methods"
        fail "$in_testname // missing methods"
        return
        return
    }
    }
    # Check the tail.
    # Check the tail.
    set actual_tail [string trim $actual_tail]
    set actual_tail [string trim $actual_tail]
    if { "$actual_tail" != "$in_tail" } then {
    if { "$actual_tail" != "$in_tail" } then {
        cp_check_errata "$in_tail" "$actual_tail" $in_errata_table
        cp_check_errata "$in_tail" "$actual_tail" $in_errata_table
        fail "$in_testname // wrong tail: $actual_tail"
        fail "$in_testname // wrong tail: $actual_tail"
        return
        return
    }
    }
    # It all worked!
    # It all worked!
    pass "$in_testname"
    pass "$in_testname"
    return
    return
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.