|
| 1 | +diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc |
| 2 | +index 76aec2a886c..dd33315163b 100644 |
| 3 | +--- a/gcc/diagnostics/sarif-sink.cc |
| 4 | ++++ b/gcc/diagnostics/sarif-sink.cc |
| 5 | +@@ -55,8 +55,10 @@ along with GCC; see the file COPYING3. If not see |
| 6 | + #include "backtrace.h" |
| 7 | + #include "xml.h" |
| 8 | + #include "intl.h" |
| 9 | ++#ifdef HAVE_AF_UNIX |
| 10 | + #include <sys/un.h> |
| 11 | + #include <sys/socket.h> |
| 12 | ++#endif |
| 13 | + |
| 14 | + namespace diagnostics { |
| 15 | + |
| 16 | +@@ -4158,6 +4160,7 @@ private: |
| 17 | + int m_ival; |
| 18 | + }; |
| 19 | + |
| 20 | ++#ifdef HAVE_AF_UNIX |
| 21 | + class sarif_socket_sink : public sarif_sink |
| 22 | + { |
| 23 | + public: |
| 24 | +@@ -4240,6 +4243,7 @@ private: |
| 25 | + |
| 26 | + unique_fd m_fd; |
| 27 | + }; |
| 28 | ++#endif |
| 29 | + |
| 30 | + /* Print the start of an embedded link to PP, as per 3.11.6. */ |
| 31 | + |
| 32 | +@@ -4566,6 +4570,7 @@ sarif_generation_options::dump (FILE *outfile, int indent) const |
| 33 | + DIAGNOSTICS_DUMPING_EMIT_BOOL_FIELD (m_state_graph); |
| 34 | + } |
| 35 | + |
| 36 | ++#ifdef HAVE_AF_UNIX |
| 37 | + void |
| 38 | + maybe_open_sarif_sink_for_socket (context &dc) |
| 39 | + { |
| 40 | +@@ -4606,6 +4611,7 @@ maybe_open_sarif_sink_for_socket (context &dc) |
| 41 | + sink_->update_printer (); |
| 42 | + dc.add_sink (std::move (sink_)); |
| 43 | + } |
| 44 | ++#endif |
| 45 | + |
| 46 | + #if CHECKING_P |
| 47 | + |
| 48 | +diff --git a/gcc/diagnostics/sarif-sink.h b/gcc/diagnostics/sarif-sink.h |
| 49 | +index 5a9914ac571..937cc49646f 100644 |
| 50 | +--- a/gcc/diagnostics/sarif-sink.h |
| 51 | ++++ b/gcc/diagnostics/sarif-sink.h |
| 52 | +@@ -188,8 +188,10 @@ extern std::unique_ptr<sarif_edge> |
| 53 | + make_sarif_edge (const digraphs::edge &e, |
| 54 | + sarif_builder *builder); |
| 55 | + |
| 56 | ++#ifdef HAVE_AF_UNIX |
| 57 | + extern void |
| 58 | + maybe_open_sarif_sink_for_socket (context &ctxt); |
| 59 | ++#endif |
| 60 | + |
| 61 | + } // namespace diagnostics |
| 62 | + |
| 63 | +diff --git a/gcc/toplev.cc b/gcc/toplev.cc |
| 64 | +index bcf1b7604c8..c8d8e2e7842 100644 |
| 65 | +--- a/gcc/toplev.cc |
| 66 | ++++ b/gcc/toplev.cc |
| 67 | +@@ -2354,7 +2354,9 @@ toplev::main (int argc, char **argv) |
| 68 | + |
| 69 | + handle_common_deferred_options (); |
| 70 | + |
| 71 | ++#ifdef HAVE_AF_UNIX |
| 72 | + diagnostics::maybe_open_sarif_sink_for_socket (*global_dc); |
| 73 | ++#endif |
| 74 | + |
| 75 | + init_local_tick (); |
| 76 | + |
0 commit comments