Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit b760fb3

Browse files
committed
sim: add some stdlib.h includes
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.
1 parent f1cf2aa commit b760fb3

File tree

7 files changed

+21
-2
lines changed

7 files changed

+21
-2
lines changed

sim/common/ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2020-01-19 Simon Marchi <simon.marchi@polymtl.ca>
2+
3+
* nrun.c: Include stdlib.h.
4+
* sim-core.c: Likewise.
5+
* sim-engine.c: Likewise.
6+
* sim-io.c: Likewise.
7+
* sim-module.c: Likewise.
8+
* sim-reason.c: Likewise.
9+
110
2019-12-19 Tom Tromey <tromey@adacore.com>
211

312
PR build/24572:

sim/common/nrun.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
2020
#endif
2121

2222
#include <signal.h>
23+
#include <stdlib.h>
2324

2425
/* For strsignal. */
2526
#ifdef HAVE_STRING_H

sim/common/sim-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "sim-hw.h"
3131
#endif
3232

33+
#include <stdlib.h>
34+
3335
/* "core" module install handler.
3436
3537
This is called via sim_module_install to install the "core"

sim/common/sim-engine.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ GNU General Public License for more details.
1717
You should have received a copy of the GNU General Public License
1818
along with this program. If not, see <http://www.gnu.org/licenses/>. */
1919

20-
#include <stdio.h>
21-
2220
#include "sim-main.h"
2321
#include "sim-assert.h"
2422

23+
#include <stdio.h>
24+
#include <stdlib.h>
25+
2526
/* Get the run state.
2627
REASON/SIGRC are the values returned by sim_stop_reason.
2728
??? Should each cpu have its own copy? */

sim/common/sim-io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <unistd.h>
3434
#endif
3535

36+
#include <stdlib.h>
37+
3638
/* Define the rate at which the simulator should poll the host
3739
for a quit. */
3840
#ifndef POLL_QUIT_INTERVAL

sim/common/sim-module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
3636

3737
#include "libiberty.h"
3838

39+
#include <stdlib.h>
40+
3941
/* List of all modules. */
4042
static MODULE_INSTALL_FN * const modules[] = {
4143
standard_install,

sim/common/sim-reason.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
2020
#include "sim-main.h"
2121
#include "sim-assert.h"
2222

23+
#include <stdlib.h>
24+
2325
/* Generic implementation of sim_stop_reason */
2426

2527
void

0 commit comments

Comments
 (0)