scantree.exp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # Copyright (C) 2000-2015 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with GCC; see the file COPYING3. If not see
  14. # <http://www.gnu.org/licenses/>.
  15. # Various utilities for scanning tree dump output, used by gcc-dg.exp and
  16. # g++-dg.exp.
  17. load_lib scandump.exp
  18. # Utility for scanning compiler result, invoked via dg-final.
  19. # Call pass if pattern is present, otherwise fail.
  20. #
  21. # Argument 0 is the regexp to match
  22. # Argument 1 is the name of the dumped tree pass
  23. # Argument 2 handles expected failures and the like
  24. proc scan-tree-dump { args } {
  25. if { [llength $args] < 2 } {
  26. error "scan-tree-dump: too few arguments"
  27. return
  28. }
  29. if { [llength $args] > 3 } {
  30. error "scan-tree-dump: too many arguments"
  31. return
  32. }
  33. if { [llength $args] >= 3 } {
  34. scan-dump "tree" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
  35. } else {
  36. scan-dump "tree" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
  37. }
  38. }
  39. # Call pass if pattern is present given number of times, otherwise fail.
  40. # Argument 0 is the regexp to match
  41. # Argument 1 is number of times the regexp must be found
  42. # Argument 2 is the name of the dumped tree pass
  43. # Argument 3 handles expected failures and the like
  44. proc scan-tree-dump-times { args } {
  45. if { [llength $args] < 3 } {
  46. error "scan-tree-dump: too few arguments"
  47. return
  48. }
  49. if { [llength $args] > 4 } {
  50. error "scan-tree-dump: too many arguments"
  51. return
  52. }
  53. if { [llength $args] >= 4 } {
  54. scan-dump-times "tree" [lindex $args 0] [lindex $args 1] \
  55. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" [lindex $args 3]
  56. } else {
  57. scan-dump-times "tree" [lindex $args 0] [lindex $args 1] \
  58. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]"
  59. }
  60. }
  61. # Call pass if pattern is not present, otherwise fail.
  62. #
  63. # Argument 0 is the regexp to match
  64. # Argument 1 is the name of the dumped tree pass
  65. # Argument 2 handles expected failures and the like
  66. proc scan-tree-dump-not { args } {
  67. if { [llength $args] < 2 } {
  68. error "scan-tree-dump-not: too few arguments"
  69. return
  70. }
  71. if { [llength $args] > 3 } {
  72. error "scan-tree-dump-not: too many arguments"
  73. return
  74. }
  75. if { [llength $args] >= 3 } {
  76. scan-dump-not "tree" [lindex $args 0] \
  77. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
  78. } else {
  79. scan-dump-not "tree" [lindex $args 0] \
  80. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
  81. }
  82. }
  83. # Utility for scanning demangled compiler result, invoked via dg-final.
  84. # Call pass if pattern is present, otherwise fail.
  85. #
  86. # Argument 0 is the regexp to match
  87. # Argument 1 is the name of the dumped tree pass
  88. # Argument 2 handles expected failures and the like
  89. proc scan-tree-dump-dem { args } {
  90. if { [llength $args] < 2 } {
  91. error "scan-tree-dump-dem: too few arguments"
  92. return
  93. }
  94. if { [llength $args] > 3 } {
  95. error "scan-tree-dump-dem: too many arguments"
  96. return
  97. }
  98. if { [llength $args] >= 3 } {
  99. scan-dump-dem "tree" [lindex $args 0] \
  100. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
  101. } else {
  102. scan-dump-dem "tree" [lindex $args 0] \
  103. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
  104. }
  105. }
  106. # Call pass if demangled pattern is not present, otherwise fail.
  107. #
  108. # Argument 0 is the regexp to match
  109. # Argument 1 is the name of the dumped tree pass
  110. # Argument 2 handles expected failures and the like
  111. proc scan-tree-dump-dem-not { args } {
  112. if { [llength $args] < 2 } {
  113. error "scan-tree-dump-dem-not: too few arguments"
  114. return
  115. }
  116. if { [llength $args] > 3 } {
  117. error "scan-tree-dump-dem-not: too many arguments"
  118. return
  119. }
  120. if { [llength $args] >= 3 } {
  121. scan-dump-dem-not "tree" [lindex $args 0] \
  122. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
  123. [lindex $args 2]
  124. } else {
  125. scan-dump-dem-not "tree" [lindex $args 0] \
  126. "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
  127. }
  128. }