diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-10-31 17:05:40 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-10-31 17:05:40 -0400 |
commit | b9e2088d2977441818e8e24f3b497b167992dba0 (patch) | |
tree | 3e62de468cb37b3e6d3ed0f92fee23a0bd3f2257 /gcc/pretty-print.h | |
parent | f66b2fc122b8a17591afbb881d580b32e8ddb708 (diff) | |
download | gcc-b9e2088d2977441818e8e24f3b497b167992dba0.zip gcc-b9e2088d2977441818e8e24f3b497b167992dba0.tar.gz gcc-b9e2088d2977441818e8e24f3b497b167992dba0.tar.bz2 |
pretty-print: gracefully handle null URLs
gcc/ChangeLog:
* pretty-print.cc (pretty_printer::pretty_printer): Initialize
m_skipping_null_url.
(pp_begin_url): Handle URL being null.
(pp_end_url): Likewise.
(selftest::test_null_urls): New.
(selftest::pretty_print_cc_tests): Call it.
* pretty-print.h (pretty_printer::m_skipping_null_url): New.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/pretty-print.h')
-rw-r--r-- | gcc/pretty-print.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 02658c8..8759f0d 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -295,6 +295,10 @@ public: /* Whether URLs should be emitted, and which terminator to use. */ diagnostic_url_format url_format; + + /* If true, then we've had a pp_begin_url (nullptr), and so the + next pp_end_url should be a no-op. */ + bool m_skipping_null_url; }; inline const char * |