[sim] Fix mbuild build breaker in sim-cpu.c
authorTom de Vries <tdevries@suse.de>
Mon, 10 Aug 2020 15:26:09 +0000 (17:26 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 10 Aug 2020 15:26:09 +0000 (17:26 +0200)
When running gdb/gdb_mbuild.sh, I run into:
...
src/sim/aarch64/../common/sim-cpu.c: In function 'sim_cpu_free':
src/sim/aarch64/../common/sim-cpu.c:64:3: error: implicit declaration of \
  function 'free' [-Werror=implicit-function-declaration]
   free (cpu);
   ^~~~
src/sim/aarch64/../common/sim-cpu.c:64:3: error: incompatible implicit \
  declaration of built-in function 'free' [-Werror]
src/sim/aarch64/../common/sim-cpu.c:64:3: note: include '<stdlib.h>' or \
  provide a declaration of 'free'
...

Fix this by adding "#include <stdlib.h>".

Tested by gdb/gdb_mbuild.sh -e aarch64-elf.

sim/common/ChangeLog:

2020-08-10  Tom de Vries  <tdevries@suse.de>

* sim-cpu.c: Include stdlib.h for free.

sim/common/ChangeLog
sim/common/sim-cpu.c

index a1ac3f13d41db76068ccd7c71f546bc02478d443..2c71b135904282ed9190c0f6dcdde38ad0523495 100644 (file)
@@ -1,3 +1,7 @@
+2020-08-10  Tom de Vries  <tdevries@suse.de>
+
+       * sim-cpu.c: Include stdlib.h for free.
+
 2020-01-19  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * nrun.c: Include stdlib.h.
index 1715508e2ffb1ddb1112fa9d753736c1f9269b8b..d1676d48313578a6d6ae524e6e2f4a145a7e8985 100644 (file)
@@ -17,6 +17,8 @@ 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 <stdlib.h>
+
 #include "sim-main.h"
 #include "bfd.h"