sim: add some stdlib.h includes
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 20 Jan 2020 00:47:17 +0000 (19:47 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 20 Jan 2020 00:48:16 +0000 (19:48 -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.

sim/common/ChangeLog
sim/common/nrun.c
sim/common/sim-core.c
sim/common/sim-engine.c
sim/common/sim-io.c
sim/common/sim-module.c
sim/common/sim-reason.c

index 6610c7ba9b2536cba2a35c717ae42c920a5a54c8..a1ac3f13d41db76068ccd7c71f546bc02478d443 100644 (file)
@@ -1,3 +1,12 @@
+2020-01-19  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * 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  <tromey@adacore.com>
 
        PR build/24572:
index abd821a74cf302c633bce5b9cd98c20be3f545b7..cbf7b5e2e14762f88492f711a13ef66ce16d2ff1 100644 (file)
@@ -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
index ce26dd3586e6013c94726c4e54fc79292a55f92b..df46def27573e34f91224d03b4d961eb7ff3a798 100644 (file)
@@ -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"
index f9961f8cfb762de188a28399f8222b73c82924af..d6e091de30e8f8fcc605b5d0f7d9fd12de4ab64a 100644 (file)
@@ -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?  */
index 05ba0180ffd8cb8450cc7d4e781ecb695bace863..989f9cfb35a757528135a135d5d1a269a99a01eb 100644 (file)
@@ -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
index 2ea54c1f653cdabb2e5ad1dbd963b28853c4be1b..1b103b7763aeae4b564fa2ad97455a282864aa81 100644 (file)
@@ -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,
index d74496a46a29a384eb0397b3b3fa40b3be435d9c..83b24242235ffb66535be39fada4654b593ebde6 100644 (file)
@@ -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