[review] Add gdb_caching_proc support_nested_function_tests to lib/gdb.exp

Message ID gerrit.1573333143000.Ic2c93bc4cc200e07e104a2398f89a9c0514bdc75@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 9, 2019, 8:59 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/604
......................................................................

Add gdb_caching_proc support_nested_function_tests to lib/gdb.exp

This commit adds the gdb_caching_proc, support_nested_function_tests,
to lib/gdb.exp.  It tests to see whether or not the C compiler has
support for nested function calls.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (support_nested_function_tests): New proc.

Change-Id: Ic2c93bc4cc200e07e104a2398f89a9c0514bdc75
---
M gdb/testsuite/lib/gdb.exp
1 file changed, 15 insertions(+), 0 deletions(-)
  

Comments

Simon Marchi (Code Review) Dec. 3, 2019, 4:41 p.m. UTC | #1
Pedro Alves has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/604
......................................................................


Patch Set 1: Code-Review+2

(1 comment)

| --- gdb/testsuite/lib/gdb.exp
| +++ gdb/testsuite/lib/gdb.exp
| @@ -6383,5 +6383,19 @@ gdb_caching_proc target_supports_scheduler_locking {
|      remote_file build delete $obj
|      verbose "$me:  returning $supports_schedule_locking" 2
|      return $supports_schedule_locking
|  }
|  
| +# Return 1 if compiler supports use of nested functions.  Otherwise,
| +# return 0.
| +
| +gdb_caching_proc support_nested_function_tests {
| +    # Compile a test program containing a nested function

PS1, Line 6392:

Missing end period.

| +    return [gdb_can_simple_compile nested_func {
| +	int main () {
| +	    int foo () {
| +	        return 0;
| +	    }
| +	    return foo ();
| +	}
| +    } executable]
| +}
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1731a3e..31205c8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6385,6 +6385,21 @@ 
     return $supports_schedule_locking
 }
 
+# Return 1 if compiler supports use of nested functions.  Otherwise,
+# return 0.
+
+gdb_caching_proc support_nested_function_tests {
+    # Compile a test program containing a nested function
+    return [gdb_can_simple_compile nested_func {
+	int main () {
+	    int foo () {
+	        return 0;
+	    }
+	    return foo ();
+	}
+    } executable]
+}
+
 # gdb_target_symbol returns the provided symbol with the correct prefix
 # prepended.  (See gdb_target_symbol_prefix, above.)