Skip tests requiring "alignof (void)" when compiling using clang
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / align.exp
index cae6862c7a8542e9679abf05c59bcbc2f1c7d690..4894de02731d4500a8197d7e6bebde29667362de 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2018-2019 Free Software Foundation, Inc.
+# Copyright 2018-2020 Free Software Foundation, Inc.
 
 # 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
@@ -80,7 +80,9 @@ puts $outfile {
 
     unsigned a_int3 = alignof (int[3]);
 
+#if !defined (__clang__)
     unsigned a_void = alignof (void);
+#endif
 
     struct base { char c; };
     struct derived : public virtual base { int i; };
@@ -170,5 +172,14 @@ foreach type $typelist {
 
 set expected [get_integer_valueof a_int3 0]
 gdb_test "print alignof(int\[3\])" " = $expected"
-set expected [get_integer_valueof a_void 0]
+
+# As an extension, GCC allows void pointer arithmetic, with
+# sizeof(void) and alignof(void) both 1.  This test checks
+# GDB's support of GCC's extension.
+if [test_compiler_info clang*] {
+    # Clang doesn't support GCC's extension.
+    set expected 1
+} else {
+    set expected [get_integer_valueof a_void 0]
+}
 gdb_test "print alignof(void)" " = $expected"
This page took 0.024614 seconds and 4 git commands to generate.