From 355e210214ba52d477f25b33de00dbbcfb566c70 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Mon, 6 Oct 2014 14:50:46 -0400 Subject: [PATCH] common-defs.h: include before When trying to build gdbserver on ppc-lynx178, the compiler reports while trying to compile gdbserver/ax.c that vsprintf is not declared. Looking at my C99 reference manual (a draft), I see the following synopsis: #include #include int vsprintf(char * restrict s, [etc]); Looking at stdio.h on LynxOS-178, if found where vsprintf gets declared: #if defined(__varargs_h) || defined(__stdarg_h) \ || defined(_VARARGS_H) || defined(_STDARG_H) extern int vsprintf _AP((char *, const char *, va_list)); #endif Digging further, I noticed that common-defs.h, which is included via server.h, includes stdarg.h after including stdio, explaining why vsprintf does not get declared in this case. This patch fixes the problem by including stdarg.h before stdio.h. gdb/ChangeLog: * common/common-defs.h: Move #include ahead of #include. Tested on x86_64-linux. --- gdb/ChangeLog | 5 +++++ gdb/common/common-defs.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bfc427f387..0ba42399c1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-11-14 Joel Brobecker + + * common/common-defs.h: Move #include ahead of + #include. + 2014-11-14 Pedro Alves * charset.c [PHONY_ICONV && !EILSEQ] (EILSEQ): Don't define. diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h index 29c8ab3039..4d2e8a73bb 100644 --- a/gdb/common/common-defs.h +++ b/gdb/common/common-defs.h @@ -27,9 +27,9 @@ #include "build-gnulib/config.h" #endif +#include #include #include -#include #include #include #include