* [PATCH] sim: add some stdlib.h includes
@ 2020-01-19 3:56 Simon Marchi
2020-01-19 21:12 ` Andrew Burgess
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-01-19 3:56 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
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 â<stdlib.h>â 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/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 ++
6 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index abd821a74cf3..cbf7b5e2e147 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#endif
#include <signal.h>
+#include <stdlib.h>
/* For strsignal. */
#ifdef HAVE_STRING_H
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index ce26dd3586e6..df46def27573 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -30,6 +30,8 @@
#include "sim-hw.h"
#endif
+#include <stdlib.h>
+
/* "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 f9961f8cfb76..d6e091de30e8 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 <http://www.gnu.org/licenses/>. */
-#include <stdio.h>
-
#include "sim-main.h"
#include "sim-assert.h"
+#include <stdio.h>
+#include <stdlib.h>
+
/* 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 05ba0180ffd8..989f9cfb35a7 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -33,6 +33,8 @@
#include <unistd.h>
#endif
+#include <stdlib.h>
+
/* 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 2ea54c1f653c..1b103b7763ae 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "libiberty.h"
+#include <stdlib.h>
+
/* 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 d74496a46a29..83b24242235f 100644
--- a/sim/common/sim-reason.c
+++ b/sim/common/sim-reason.c
@@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-main.h"
#include "sim-assert.h"
+#include <stdlib.h>
+
/* Generic implementation of sim_stop_reason */
void
--
2.24.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: add some stdlib.h includes
2020-01-19 3:56 [PATCH] sim: add some stdlib.h includes Simon Marchi
@ 2020-01-19 21:12 ` Andrew Burgess
2020-01-20 9:17 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2020-01-19 21:12 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
* Simon Marchi <simon.marchi@polymtl.ca> [2020-01-18 21:10:49 -0500]:
> 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 ‘<stdlib.h>’ 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.
LGTM.
Thanks,
Andrew
> ---
> 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 ++
> 6 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/sim/common/nrun.c b/sim/common/nrun.c
> index abd821a74cf3..cbf7b5e2e147 100644
> --- a/sim/common/nrun.c
> +++ b/sim/common/nrun.c
> @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
> #endif
>
> #include <signal.h>
> +#include <stdlib.h>
>
> /* For strsignal. */
> #ifdef HAVE_STRING_H
> diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
> index ce26dd3586e6..df46def27573 100644
> --- a/sim/common/sim-core.c
> +++ b/sim/common/sim-core.c
> @@ -30,6 +30,8 @@
> #include "sim-hw.h"
> #endif
>
> +#include <stdlib.h>
> +
> /* "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 f9961f8cfb76..d6e091de30e8 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 <http://www.gnu.org/licenses/>. */
>
> -#include <stdio.h>
> -
> #include "sim-main.h"
> #include "sim-assert.h"
>
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> /* 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 05ba0180ffd8..989f9cfb35a7 100644
> --- a/sim/common/sim-io.c
> +++ b/sim/common/sim-io.c
> @@ -33,6 +33,8 @@
> #include <unistd.h>
> #endif
>
> +#include <stdlib.h>
> +
> /* 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 2ea54c1f653c..1b103b7763ae 100644
> --- a/sim/common/sim-module.c
> +++ b/sim/common/sim-module.c
> @@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
>
> #include "libiberty.h"
>
> +#include <stdlib.h>
> +
> /* 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 d74496a46a29..83b24242235f 100644
> --- a/sim/common/sim-reason.c
> +++ b/sim/common/sim-reason.c
> @@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
> #include "sim-main.h"
> #include "sim-assert.h"
>
> +#include <stdlib.h>
> +
> /* Generic implementation of sim_stop_reason */
>
> void
> --
> 2.24.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: add some stdlib.h includes
2020-01-19 21:12 ` Andrew Burgess
@ 2020-01-20 9:17 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2020-01-20 9:17 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches
On 2020-01-19 4:11 p.m., Andrew Burgess wrote:
> * Simon Marchi <simon.marchi@polymtl.ca> [2020-01-18 21:10:49 -0500]:
>
>> 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 â<stdlib.h>â 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.
>
> LGTM.
>
> Thanks,
> Andrew
Thanks, pushed.
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-20 0:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 3:56 [PATCH] sim: add some stdlib.h includes Simon Marchi
2020-01-19 21:12 ` Andrew Burgess
2020-01-20 9:17 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).