From b760fb3a1cd35fda01843ee7cdb3e420f07d27b9 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sun, 19 Jan 2020 19:47:17 -0500 Subject: [PATCH] sim: add some stdlib.h includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When trying to compile GDB with --target=avr, with gcc 9.2.0, I am getting a bunch of: /home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: error: implicit declaration of function ‘abort’ [-Werror=implicit-function-declaration] 94 | abort (); | ^~~~~ /home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: error: incompatible implicit declaration of built-in function ‘abort’ [-Werror] /home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: note: include ‘’ or provide a declaration of ‘abort’ I did what the compiler told me and added the relevant includes in the problematic files. sim/common/ChangeLog: * nrun.c: Include stdlib.h. * sim-core.c: Likewise. * sim-engine.c: Likewise. * sim-io.c: Likewise. * sim-module.c: Likewise. * sim-reason.c: Likewise. --- sim/common/ChangeLog | 9 +++++++++ sim/common/nrun.c | 1 + sim/common/sim-core.c | 2 ++ sim/common/sim-engine.c | 5 +++-- sim/common/sim-io.c | 2 ++ sim/common/sim-module.c | 2 ++ sim/common/sim-reason.c | 2 ++ 7 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 6610c7ba9b..a1ac3f13d4 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,12 @@ +2020-01-19 Simon Marchi + + * nrun.c: Include stdlib.h. + * sim-core.c: Likewise. + * sim-engine.c: Likewise. + * sim-io.c: Likewise. + * sim-module.c: Likewise. + * sim-reason.c: Likewise. + 2019-12-19 Tom Tromey PR build/24572: diff --git a/sim/common/nrun.c b/sim/common/nrun.c index abd821a74c..cbf7b5e2e1 100644 --- a/sim/common/nrun.c +++ b/sim/common/nrun.c @@ -20,6 +20,7 @@ along with this program. If not, see . */ #endif #include +#include /* For strsignal. */ #ifdef HAVE_STRING_H diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c index ce26dd3586..df46def275 100644 --- a/sim/common/sim-core.c +++ b/sim/common/sim-core.c @@ -30,6 +30,8 @@ #include "sim-hw.h" #endif +#include + /* "core" module install handler. This is called via sim_module_install to install the "core" diff --git a/sim/common/sim-engine.c b/sim/common/sim-engine.c index f9961f8cfb..d6e091de30 100644 --- a/sim/common/sim-engine.c +++ b/sim/common/sim-engine.c @@ -17,11 +17,12 @@ 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 - #include "sim-main.h" #include "sim-assert.h" +#include +#include + /* Get the run state. REASON/SIGRC are the values returned by sim_stop_reason. ??? Should each cpu have its own copy? */ diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c index 05ba0180ff..989f9cfb35 100644 --- a/sim/common/sim-io.c +++ b/sim/common/sim-io.c @@ -33,6 +33,8 @@ #include #endif +#include + /* Define the rate at which the simulator should poll the host for a quit. */ #ifndef POLL_QUIT_INTERVAL diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c index 2ea54c1f65..1b103b7763 100644 --- a/sim/common/sim-module.c +++ b/sim/common/sim-module.c @@ -36,6 +36,8 @@ along with this program. If not, see . */ #include "libiberty.h" +#include + /* List of all modules. */ static MODULE_INSTALL_FN * const modules[] = { standard_install, diff --git a/sim/common/sim-reason.c b/sim/common/sim-reason.c index d74496a46a..83b2424223 100644 --- a/sim/common/sim-reason.c +++ b/sim/common/sim-reason.c @@ -20,6 +20,8 @@ along with this program. If not, see . */ #include "sim-main.h" #include "sim-assert.h" +#include + /* Generic implementation of sim_stop_reason */ void