gdb: Fix build failure in xml-tdesc.c without expat.

Message ID 1455231367-29672-1-git-send-email-koriakin@0x04.net
State New, archived
Headers

Commit Message

Marcin Kościelnicki Feb. 11, 2016, 10:56 p.m. UTC
  Introduced by 18d3cec54e1b4fce278dba436484846f8048d7d6.

gdb/ChangeLog:

	* xml-tdesc.c (target_fetch_description_xml): Return NULL when
	built without expat.
---
OK to push?  Or should we emit a warning in this case?

 gdb/ChangeLog   | 5 +++++
 gdb/xml-tdesc.c | 4 ++++
 2 files changed, 9 insertions(+)
  

Comments

Pedro Alves Feb. 12, 2016, 10:06 a.m. UTC | #1
On 02/11/2016 10:56 PM, Marcin Kościelnicki wrote:
> Introduced by 18d3cec54e1b4fce278dba436484846f8048d7d6.
> 
> gdb/ChangeLog:
> 
> 	* xml-tdesc.c (target_fetch_description_xml): Return NULL when
> 	built without expat.
> ---
> OK to push?  Or should we emit a warning in this case?

Yes, I think we should emit a warning.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5edafdf..4856db5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-02-11  Marcin Kościelnicki  <koriakin@0x04.net>
+
+	* xml-tdesc.c (target_fetch_description_xml): Return NULL when
+	built without expat.
+
 2016-02-11  Pedro Alves  <palves@redhat.com>
 
 	* Makefile.in (check-parallel): New rule.
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index 4625b60..22cf26b 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -638,6 +638,9 @@  target_read_description_xml (struct target_ops *ops)
 char *
 target_fetch_description_xml (struct target_ops *ops)
 {
+#if !defined(HAVE_LIBEXPAT)
+  return NULL;
+#else
   struct target_desc *tdesc;
   char *tdesc_str;
   char *expanded_text;
@@ -659,4 +662,5 @@  target_fetch_description_xml (struct target_ops *ops)
     }
 
   return expanded_text;
+#endif
 }