mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 22:48:57 +08:00
gdb: Workaround stringop-overread warning in debuginfod-support.c on s390x
For some reason g++ 11.2.1 on s390x produces a spurious warning for stringop-overread in debuginfod_is_enabled for url_view. Add a new DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD macro to suppress this warning. include/ChangeLog: * diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD): New macro. gdb/ChangeLog: * debuginfod-support.c (debuginfod_is_enabled): Use DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD on s390x.
This commit is contained in:
@ -17,6 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "diagnostics.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "gdbsupport/scoped_fd.h"
|
#include "gdbsupport/scoped_fd.h"
|
||||||
#include "debuginfod-support.h"
|
#include "debuginfod-support.h"
|
||||||
@ -192,7 +193,17 @@ debuginfod_is_enabled ()
|
|||||||
if (off == gdb::string_view::npos)
|
if (off == gdb::string_view::npos)
|
||||||
break;
|
break;
|
||||||
url_view = url_view.substr (off);
|
url_view = url_view.substr (off);
|
||||||
|
#if defined (__s390x__)
|
||||||
|
/* g++ 11.2.1 on s390x seems convinced url_view might be of
|
||||||
|
SIZE_MAX length. And so complains because the length of
|
||||||
|
an array can only be PTRDIFF_MAX. */
|
||||||
|
DIAGNOSTIC_PUSH
|
||||||
|
DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
|
||||||
|
#endif
|
||||||
off = url_view.find_first_of (' ');
|
off = url_view.find_first_of (' ');
|
||||||
|
#if defined (__s390x__)
|
||||||
|
DIAGNOSTIC_POP
|
||||||
|
#endif
|
||||||
gdb_printf
|
gdb_printf
|
||||||
(_(" <%ps>\n"),
|
(_(" <%ps>\n"),
|
||||||
styled_string (file_name_style.style (),
|
styled_string (file_name_style.style (),
|
||||||
|
@ -76,6 +76,9 @@
|
|||||||
# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
|
# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
|
||||||
DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
|
DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
|
||||||
|
|
||||||
|
# define DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD \
|
||||||
|
DIAGNOSTIC_IGNORE ("-Wstringop-overread")
|
||||||
|
|
||||||
# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
|
# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
|
||||||
DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")
|
DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")
|
||||||
|
|
||||||
@ -108,6 +111,10 @@
|
|||||||
# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
|
# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
|
||||||
|
# define DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
|
#ifndef DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
|
||||||
# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
|
# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user