From patchwork Sun Dec 2 13:05:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 30519 Received: (qmail 76294 invoked by alias); 2 Dec 2018 13:05:32 -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 76131 invoked by uid 89); 2 Dec 2018 13:05:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:9f01, H*r:sk:mail-pg, Hx-spam-relays-external:209.85.215.194, H*RU:209.85.215.194 X-HELO: mail-pg1-f194.google.com Received: from mail-pg1-f194.google.com (HELO mail-pg1-f194.google.com) (209.85.215.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 02 Dec 2018 13:05:26 +0000 Received: by mail-pg1-f194.google.com with SMTP id t13so4475013pgr.11 for ; Sun, 02 Dec 2018 05:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PBowECEsX6dWrK0fJaoJ938qSIO2vEhdPbxhWFIh8ys=; b=PS/QELvrePSTz7kFLle7YiGECLap7CvOtlMEIgV3zinOyb1crF8UmJhPh9CTyKXbm1 WZs/jM4AYk6c6z+qF3pNfnOjsct0DHyDWrkbLhnHE86tgCLFa6gZ/CEf4GmDc0Nxj9Ke q6N2OQ/IoltjTF/hC0+OUUMehCQb1RT7il4aZDmifaYYDyWy38MsBHlEMn/Y8PzAvTyC g1/cEArdvcvh6mLPaIh8eX3dpY0WG1CWAenUOMOwHojmUUY5dbsNtB+W3qKXcJkwVINs iFOj2Ki+YcTOGYj0nCxmIgmIJwI6clEd7t1GdZOWuUEEnUzlGOpIGclNiCrfGF9pUCRH JPiQ== Return-Path: Received: from localhost (g206.124-44-15.ppp.wakwak.ne.jp. [124.44.15.206]) by smtp.gmail.com with ESMTPSA id d202sm16907826pfd.58.2018.12.02.05.05.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Dec 2018 05:05:23 -0800 (PST) From: Stafford Horne To: GDB patches Cc: Stafford Horne Subject: [PATCH 3/3] sim/common: Fix warnings: "warning: implicit declaration of function..." Date: Sun, 2 Dec 2018 22:05:10 +0900 Message-Id: <20181202130510.10056-4-shorne@gmail.com> In-Reply-To: <20181202130510.10056-1-shorne@gmail.com> References: <20181202130510.10056-1-shorne@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes During building of several cgen simulator's I notices the below warnings. Adding includes fixes these. Including config.h allows stdio.h to properly configure itself to expose asprintf(). The other warnings for abort, free, memset, strlen are trivial. Warnings: ../../../binutils-gdb/sim/or1k/../common/sim-watch.c: In function ‘sim_watchpoint_install’: ../../../binutils-gdb/sim/or1k/../common/sim-watch.c:415:10: warning: implicit declaration of function ‘asprintf’; did you mean ‘vasprintf’? [-Wimplicit-function-declaration] if (asprintf (&name, "watch-%s-%s", ^~~~~~~~ vasprintf ../../../binutils-gdb/sim/lm32/../common/hw-device.c: In function ‘hw_strdup’: ../../../binutils-gdb/sim/lm32/../common/hw-device.c:59:34: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] char *dup = hw_zalloc (me, strlen (str) + 1); ^~~~~~ ../../../binutils-gdb/sim/lm32/../common/hw-events.c: In function ‘hw_event_queue_schedule’: ../../../binutils-gdb/sim/lm32/../common/hw-events.c:92:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration] memset (&dummy, 0, sizeof dummy); ^~~~~~ ../../../binutils-gdb/sim/lm32/../common/hw-handles.c: In function ‘hw_handle_remove_ihandle’: ../../../binutils-gdb/sim/lm32/../common/hw-handles.c:211:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration] free (delete); ^~~~ ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c: In function ‘pack_fpu’: ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c:292:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration] abort (); ^~~~~ sim/common/ChangeLog: * sim-options.c: Include "config.h". Include . * sim-watch.c: Include "config.h". Include . * hw-device.c: Include "string.h". * hw-events.c: Include "string.h". * hw-handles.c: Include . * sim-fpu.c: Include . --- sim/common/hw-device.c | 4 ++++ sim/common/hw-events.c | 3 +++ sim/common/hw-handles.c | 3 +++ sim/common/sim-fpu.c | 3 +++ sim/common/sim-options.c | 2 ++ sim/common/sim-watch.c | 2 ++ 6 files changed, 17 insertions(+) diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c index eef3373151..4dee1eca38 100644 --- a/sim/common/hw-device.c +++ b/sim/common/hw-device.c @@ -27,6 +27,10 @@ #include #endif +#if HAVE_STRING_H +#include +#endif + /* Address methods */ const hw_unit * diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c index d59c39ee9f..ca2063fa84 100644 --- a/sim/common/hw-events.c +++ b/sim/common/hw-events.c @@ -23,6 +23,9 @@ along with this program. If not, see . */ #include "sim-events.h" +#if HAVE_STRING_H +#include +#endif /* The hw-events object is implemented using sim-events */ diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c index 1d03c2b97e..57690db101 100644 --- a/sim/common/hw-handles.c +++ b/sim/common/hw-handles.c @@ -23,6 +23,9 @@ #include "hw-main.h" #include "hw-base.h" +#if HAVE_STDLIB_H +#include +#endif struct hw_handle_mapping { diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c index ce5fafbf4c..3d4c34c971 100644 --- a/sim/common/sim-fpu.c +++ b/sim/common/sim-fpu.c @@ -41,6 +41,9 @@ along with this program. If not, see . */ #include "sim-io.h" #include "sim-assert.h" +#ifdef HAVE_STDLIB_H +#include +#endif /* Debugging support. If digits is -1, then print all digits. */ diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 96c6bb8509..3a05d8e964 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -17,6 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "config.h" #include "sim-main.h" #ifdef HAVE_STRING_H #include @@ -29,6 +30,7 @@ along with this program. If not, see . */ #include #endif #include +#include #include "libiberty.h" #include "sim-options.h" #include "sim-io.h" diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c index b29ac3bab2..d7eddeeb4e 100644 --- a/sim/common/sim-watch.c +++ b/sim/common/sim-watch.c @@ -17,12 +17,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "config.h" #include "sim-main.h" #include "sim-options.h" #include "sim-assert.h" #include +#include #ifdef HAVE_STRING_H #include