gdb: Fix alignment computation for structs with only static fields
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / align.exp
index 558625d1b3e7a31fdff3416b4640d51c04d5d189..e3ca0470e9461fc5934f66a9506ea5014ed01d6c 100644 (file)
@@ -67,8 +67,10 @@ proc prepare_test_source_file { lang } {
     puts -nonewline $outfile "#define DEF(T,U) struct align_pair_ ## T ## _x_ ## U "
     puts $outfile "{ T one; U two; }"
     if { $lang == "c++" } {
-       puts -nonewline $outfile "#define DEF_WITH_STATIC(T,U) struct align_pair_static_ ## T ## _x_ ## U "
+       puts -nonewline $outfile "#define DEF_WITH_1_STATIC(T,U) struct align_pair_static_ ## T ## _x_ ## U "
        puts $outfile "{ static T one; U two; }"
+       puts -nonewline $outfile "#define DEF_WITH_2_STATIC(T,U) struct align_pair_static_ ## T ## _x_static_ ## U "
+       puts $outfile "{ static T one; static U two; }"
     }
     if { $lang == "c" } {
        puts $outfile "unsigned a_void = ${align_func} (void);"
@@ -99,11 +101,17 @@ proc prepare_test_source_file { lang } {
            puts $outfile "  = ${align_func} (struct align_pair_${joined});"
 
            if { $lang == "c++" } {
-               puts $outfile "DEF_WITH_STATIC ($utype, $uinner);"
-               set joined "${utype}_x_${uinner}"
-               puts $outfile "struct align_pair_static_$joined item_static_${joined};"
-               puts $outfile "unsigned a_static_${joined}"
-               puts $outfile "  = ${align_func} (struct align_pair_static_${joined});"
+               puts $outfile "DEF_WITH_1_STATIC ($utype, $uinner);"
+               set joined "static_${utype}_x_${uinner}"
+               puts $outfile "struct align_pair_$joined item_${joined};"
+               puts $outfile "unsigned a_${joined}"
+               puts $outfile "  = ${align_func} (struct align_pair_${joined});"
+
+               puts $outfile "DEF_WITH_2_STATIC ($utype, $uinner);"
+               set joined "static_${utype}_x_static_${uinner}"
+               puts $outfile "struct align_pair_$joined item_${joined};"
+               puts $outfile "unsigned a_${joined}"
+               puts $outfile "  = ${align_func} (struct align_pair_${joined});"
            }
        }
     }
@@ -160,6 +168,10 @@ proc run_alignment_test { lang } {
                set expected [get_integer_valueof a_static_${utype}_x_${uinner} 0]
                gdb_test "print ${align_func}(struct align_pair_static_${utype}_x_${uinner})" \
                    " = $expected"
+
+               set expected [get_integer_valueof a_static_${utype}_x_static_${uinner} 0]
+               gdb_test "print ${align_func}(struct align_pair_static_${utype}_x_static_${uinner})" \
+                   " = $expected"
            }
        }
     }
This page took 0.032607 seconds and 4 git commands to generate.