Fix -Wstring-compare testcase build failure
authorGary Benson <gbenson@redhat.com>
Fri, 26 Jun 2020 13:53:28 +0000 (14:53 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 26 Jun 2020 13:53:28 +0000 (14:53 +0100)
commitf53b3eeb677aace413d45b4b3c9d23d57d7167fc
treec603ca7a67446c6ba38b29e3dec3a10c9a5cdb12
parentedf92af0fbc064243069578353ff569462c3df5b
Fix -Wstring-compare testcase build failure

Clang fails to compile the file gdb/testsuite/gdb.cp/try_catch.cc
with the following error:
  warning: result of comparison against a string literal is
  unspecified (use strncmp instead) [-Wstring-compare]

This commit fixes the error, replacing the pointer comparison with
a call to strcmp.  This commit also adds a final check: the test
program is run to the final return statement, and the value of
"test" is checked to ensure it is still "true" at that point.

gdb/testsuite/ChangeLog:

* gdb.cp/try_catch.cc: Include string.h.
(main): Replace comparison against string literal with
strcmp, avoiding build failure with -Wstring-compare.
Add "marker test-complete".
* gdb.cp/try_catch.exp: Run the test to the above marker,
then verify that the value of "test" is still true.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/try_catch.cc
gdb/testsuite/gdb.cp/try_catch.exp
This page took 0.027031 seconds and 4 git commands to generate.