From patchwork Fri Nov 14 16:48:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 3740 Received: (qmail 10318 invoked by alias); 14 Nov 2014 16:48:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10301 invoked by uid 89); 14 Nov 2014 16:48:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 14 Nov 2014 16:48:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id CBBD61168E9 for ; Fri, 14 Nov 2014 11:48:11 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id znMsG6wDBVdh for ; Fri, 14 Nov 2014 11:48:11 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 63C161168C0 for ; Fri, 14 Nov 2014 11:48:11 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id C861F40F79; Fri, 14 Nov 2014 20:48:09 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] common-defs.h: include before Date: Fri, 14 Nov 2014 20:48:08 +0400 Message-Id: <1415983688-26796-1-git-send-email-brobecker@adacore.com> 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. This was also implicitly tested on all the platforms that we build GDB & GDBserver on, and no problem has been detected since we made that change (Oct 6th). OK to commit? Thanks, diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h index 29c8ab3..4d2e8a7 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