+2020-12-19 Tom de Vries <tdevries@suse.de>
+
+ * lib/gdb.exp (supports_scalar_storage_order_attribute)
+ (supports_gnuc): New proc.
+ * gdb.base/endianity.exp: Define TEST_SSO. Eliminate
+ test_compiler_info calls. Add unsupported message.
+ * gdb.base/endianity.c: Use TEST_SSO.
+
2020-12-19 Hannes Domani <ssbssa@yahoo.de>
PR exp/27070
__complex__ float cplx;
double d;
}
-#if defined __GNUC__ && (__GNUC__ >= 6)
+#if TEST_SSO
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
__attribute__( ( scalar_storage_order( "big-endian" ) ) )
#else
standard_testfile .c
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+set test_sso [expr \
+ [supports_scalar_storage_order_attribute] \
+ && [supports_gnuc]]
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ [list debug additional_flags=-DTEST_SSO=$test_sso]] } {
return -1
}
gdb_test "print o" "= {v = 4, w = 3, x = 2, f = 1.5, cplx = 1.25 \\+ 7.25i, d = -23.125}" \
"print o after assignment"
-if { ([test_compiler_info {gcc-[0-5]-*}] || ![test_compiler_info gcc*]) } {
+if { !$test_sso } {
# The rest of the testcase requires Scalar Storage Order support.
# This compiler does not support it, so skip the rest.
+ unsupported "No scalar storage order support"
return -1
}
gdb_test "x/x &o.v" "0x04000000"
gdb_test "x/xh &o.w" "0x0300"
-
return [gdb_simple_compile $me $src executable $flags]
}
+# Return 1 if compiler supports scalar_storage_order attribute, otherwise
+# return 0.
+gdb_caching_proc supports_scalar_storage_order_attribute {
+ set me "supports_scalar_storage_order_attribute"
+ set src {
+ #include <string.h>
+ struct sle {
+ int v;
+ } __attribute__((scalar_storage_order("little-endian")));
+ struct sbe {
+ int v;
+ } __attribute__((scalar_storage_order("big-endian")));
+ struct sle sle;
+ struct sbe sbe;
+ int main () {
+ sle.v = sbe.v = 0x11223344;
+ int same = memcmp (&sle, &sbe, sizeof (int)) == 0;
+ int sso = !same;
+ return sso;
+ }
+ }
+ if { ![gdb_simple_compile $me $src executable ""] } {
+ return 0
+ }
+
+ set result [remote_exec target $obj]
+ set status [lindex $result 0]
+ set output [lindex $result 1]
+ if { $output != "" } {
+ return 0
+ }
+
+ return $status
+}
+
+# Return 1 if compiler supports __GNUC__, otherwise return 0.
+gdb_caching_proc supports_gnuc {
+ set me "supports_gnuc"
+ set src {
+ #ifndef __GNUC__
+ #error "No gnuc"
+ #endif
+ }
+ return [gdb_simple_compile $me $src object ""]
+}
+
# Always load compatibility stuff.
load_lib future.exp