Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH, gdb/testsuite] Fix wrong return type in tests
@ 2017-11-29 10:48 Thomas Preudhomme
  2017-11-29 11:04 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Preudhomme @ 2017-11-29 10:48 UTC (permalink / raw)
  To: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Hi,

The following tests are marked untested with latest GCC due to a warning
being emitted for a mismatch between their return type and what the lack
of return statement:

* gdb.cp/breakpoint.exp
* gdb.cp/psymtab-parameter.exp
* gdb.cp/shadow.exp

This patch fix the return type to match the function definitions.

ChangeLog entries is as follows:

*** gdb/testsuite/ChangeLog ***

2017-11-29  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* gdb.cp/breakpoint.cc (bar): Set return type to void.
	* gdb.cp/psymtab-parameter.cc (func): Likewise.
	* gdb.cp/psymtab-parameter.exp: Update comment regarding prototype of
	func ().
	* gdb.cp/shadow.cc (B.func): Return 0.

Testing: Tests PASS on arm-none-eabi with this fix but are marked
UNTESTED without.

Committed as obvious.

Best regards,

Thomas

[-- Attachment #2: fix_return_type_tests.patch --]
[-- Type: text/x-patch, Size: 1888 bytes --]

diff --git a/gdb/testsuite/gdb.cp/breakpoint.cc b/gdb/testsuite/gdb.cp/breakpoint.cc
index fc9b9d9f3e55813ac549ec06d4bdb393e1a93809..1feff44cd38cdc385abd2c4ea3c9dcf8b57c4861 100644
--- a/gdb/testsuite/gdb.cp/breakpoint.cc
+++ b/gdb/testsuite/gdb.cp/breakpoint.cc
@@ -28,7 +28,7 @@ public:
     return 1; // conditional breakpoint in method
   }
 
-  int bar ()
+  void bar ()
   {
     for (int i = 0; i < 1; ++i)
       {
diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.cc b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
index 0990430c128413ecc21bcf65ebf58a1899f535fa..9f63fefcaeb800f7444fe74225514d3330036e5b 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.cc
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
@@ -16,7 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 template <typename T>
-long
+void
 func ()
 {
 }
diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.exp b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
index 3d78de91f4b3752d754bd776ae3532700a308a40..5c4b6ac71927fe9030bd9ce66111761425ab433b 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.exp
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
@@ -31,6 +31,6 @@ gdb_test_no_output "set language c++"
 # XFAIL than FAIL here.  For example -readnow breaks it.
 gdb_test_no_output "maintenance info symtabs"
 
-# GDB has shown only the `long func<short>()' ELF symbol before, not the DWARF
+# GDB has shown only the `void func<short>()' ELF symbol before, not the DWARF
 # symbol
 gdb_test "complete p 'func<short>(" "p 'func<short>\\(\\)"
diff --git a/gdb/testsuite/gdb.cp/shadow.cc b/gdb/testsuite/gdb.cp/shadow.cc
index 0520b2aeb8b6afecd7091cac3e295bec99c485b1..4c9fb12a7bbe95a89c3b7df2cb2782fabeec462a 100644
--- a/gdb/testsuite/gdb.cp/shadow.cc
+++ b/gdb/testsuite/gdb.cp/shadow.cc
@@ -36,6 +36,7 @@ public:
               }
           }
       }
+    return 0;
   }
 };
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, gdb/testsuite] Fix wrong return type in tests
  2017-11-29 10:48 [PATCH, gdb/testsuite] Fix wrong return type in tests Thomas Preudhomme
@ 2017-11-29 11:04 ` Pedro Alves
  2017-11-29 11:59   ` Thomas Preudhomme
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2017-11-29 11:04 UTC (permalink / raw)
  To: Thomas Preudhomme, GDB Patches

On 11/29/2017 10:48 AM, Thomas Preudhomme wrote:
> index 0990430c128413ecc21bcf65ebf58a1899f535fa..9f63fefcaeb800f7444fe74225514d3330036e5b 100644
> --- a/gdb/testsuite/gdb.cp/psymtab-parameter.cc
> +++ b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
> @@ -16,7 +16,7 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
>  template <typename T>
> -long
> +void
>  func ()
>  {
>  }
> diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.exp b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
> index 3d78de91f4b3752d754bd776ae3532700a308a40..5c4b6ac71927fe9030bd9ce66111761425ab433b 100644
> --- a/gdb/testsuite/gdb.cp/psymtab-parameter.exp
> +++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
> @@ -31,6 +31,6 @@ gdb_test_no_output "set language c++"
>  # XFAIL than FAIL here.  For example -readnow breaks it.
>  gdb_test_no_output "maintenance info symtabs"
>  
> -# GDB has shown only the `long func<short>()' ELF symbol before, not the DWARF
> +# GDB has shown only the `void func<short>()' ELF symbol before, not the DWARF
>  # symbol
>  gdb_test "complete p 'func<short>(" "p 'func<short>\\(\\)"

I think the return type may have been significant for this test.
See comments around DMGL_RET_DROP in commit 900e11f9ec1e.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, gdb/testsuite] Fix wrong return type in tests
  2017-11-29 11:04 ` Pedro Alves
@ 2017-11-29 11:59   ` Thomas Preudhomme
  2017-11-29 12:06     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Preudhomme @ 2017-11-29 11:59 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

My apologize, I thought it couldn't be significant since it was not returning 
anything. I didn't think about the impact on the prototype itself. How about 
making it return 0 instead then?

Best regards,

Thomas

On 29/11/17 11:04, Pedro Alves wrote:
> On 11/29/2017 10:48 AM, Thomas Preudhomme wrote:
>> index 0990430c128413ecc21bcf65ebf58a1899f535fa..9f63fefcaeb800f7444fe74225514d3330036e5b 100644
>> --- a/gdb/testsuite/gdb.cp/psymtab-parameter.cc
>> +++ b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
>> @@ -16,7 +16,7 @@
>>      along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>>   
>>   template <typename T>
>> -long
>> +void
>>   func ()
>>   {
>>   }
>> diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.exp b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
>> index 3d78de91f4b3752d754bd776ae3532700a308a40..5c4b6ac71927fe9030bd9ce66111761425ab433b 100644
>> --- a/gdb/testsuite/gdb.cp/psymtab-parameter.exp
>> +++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
>> @@ -31,6 +31,6 @@ gdb_test_no_output "set language c++"
>>   # XFAIL than FAIL here.  For example -readnow breaks it.
>>   gdb_test_no_output "maintenance info symtabs"
>>   
>> -# GDB has shown only the `long func<short>()' ELF symbol before, not the DWARF
>> +# GDB has shown only the `void func<short>()' ELF symbol before, not the DWARF
>>   # symbol
>>   gdb_test "complete p 'func<short>(" "p 'func<short>\\(\\)"
> 
> I think the return type may have been significant for this test.
> See comments around DMGL_RET_DROP in commit 900e11f9ec1e.
> 
> Thanks,
> Pedro Alves
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, gdb/testsuite] Fix wrong return type in tests
  2017-11-29 11:59   ` Thomas Preudhomme
@ 2017-11-29 12:06     ` Pedro Alves
  2017-11-29 13:43       ` Thomas Preudhomme
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2017-11-29 12:06 UTC (permalink / raw)
  To: Thomas Preudhomme, GDB Patches

On 11/29/2017 11:59 AM, Thomas Preudhomme wrote:
> My apologize, I thought it couldn't be significant since it was not
> returning anything.  I didn't think about the impact on the prototype
> itself. 

No worries.  It was easy to miss.

How about making it return 0 instead then?

Yes please, go ahead and push such a fix in.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, gdb/testsuite] Fix wrong return type in tests
  2017-11-29 12:06     ` Pedro Alves
@ 2017-11-29 13:43       ` Thomas Preudhomme
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Preudhomme @ 2017-11-29 13:43 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

Done (see attached patch).

*** gdb/testsuite/ChangeLog ***

2017-11-29  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* gdb.cp/psymtab-parameter.cc (func): Change return type back to long.
	Return 0 as a long.
	* gdb.cp/psymtab-parameter.exp: Change func's return type back to long.

Testing: Testcase still PASSes with the change.

Best regards,

Thomas

On 29/11/17 12:06, Pedro Alves wrote:
> On 11/29/2017 11:59 AM, Thomas Preudhomme wrote:
>> My apologize, I thought it couldn't be significant since it was not
>> returning anything.  I didn't think about the impact on the prototype
>> itself.
> 
> No worries.  It was easy to miss.
> 
> How about making it return 0 instead then?
> 
> Yes please, go ahead and push such a fix in.
> 
> Thanks,
> Pedro Alves
> 

[-- Attachment #2: fix_return_type_psymtab-parameter.patch --]
[-- Type: text/x-patch, Size: 1150 bytes --]

diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.cc b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
index 9f63fefcaeb800f7444fe74225514d3330036e5b..63038f03237b64ce4bff88e42fee7f836eca3249 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.cc
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
@@ -16,9 +16,10 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 template <typename T>
-void
+long
 func ()
 {
+  return 0L;
 }
 
 void
diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.exp b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
index 5c4b6ac71927fe9030bd9ce66111761425ab433b..3d78de91f4b3752d754bd776ae3532700a308a40 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.exp
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
@@ -31,6 +31,6 @@ gdb_test_no_output "set language c++"
 # XFAIL than FAIL here.  For example -readnow breaks it.
 gdb_test_no_output "maintenance info symtabs"
 
-# GDB has shown only the `void func<short>()' ELF symbol before, not the DWARF
+# GDB has shown only the `long func<short>()' ELF symbol before, not the DWARF
 # symbol
 gdb_test "complete p 'func<short>(" "p 'func<short>\\(\\)"

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-29 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 10:48 [PATCH, gdb/testsuite] Fix wrong return type in tests Thomas Preudhomme
2017-11-29 11:04 ` Pedro Alves
2017-11-29 11:59   ` Thomas Preudhomme
2017-11-29 12:06     ` Pedro Alves
2017-11-29 13:43       ` Thomas Preudhomme

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox