]> sourceware.org Git - newlib-cygwin.git/commitdiff
libgloss/cris: Make C declarations present and match them
authorHans-Peter Nilsson <hp@axis.com>
Mon, 4 Dec 2023 17:00:26 +0000 (18:00 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Wed, 6 Dec 2023 17:45:57 +0000 (18:45 +0100)
This is the libgloss part.
Recently, there was a change in gcc such that implicit function
declarations and type mismatches are now errors, no longer just
warnings.  Fix by adding and correcting declarations warned about;
including the right header or adding a declaration (for "main" in
lcrt0.c) and adjust to those types as necessary.

libgloss/cris/gensyscalls
libgloss/cris/lcrt0.c
libgloss/cris/linunistd.h
libgloss/cris/outbyte.c

index c36f2848871c5dd06dfcb4f64bee3683572c3ccd..0b5b0731a72592e41b6db0308c087fc2bf6a86f0 100644 (file)
@@ -1,5 +1,5 @@
 #! /bin/sh
-#  Copyright (C) 2005, 2018 Axis Communications.
+#  Copyright (C) 2005, 2018, 2023 Axis Communications.
 #  All rights reserved.
 #
 #  Redistribution and use in source and binary forms, with or without
@@ -40,13 +40,14 @@ lu='/* -*- buffer-read-only: t -*-
 #define R(x) return (x); }
 '
 lui="$lu int"
+lul="$lu long int"
 r=") { R (_Sys_"
 
 cat > close.c <<EOF
 $lui _close (int fd${r}close (fd))
 EOF
 cat > execve.c <<EOF
-$lui _execve (char *path, char **argv, char **env${r}execve (path, argv, env))
+$lui _execve (const char *path, char * const *argv, char *const *env${r}execve (path, argv, env))
 EOF
 cat > exit.c <<EOF
 $lu void _exit (int val) { _Sys_exit (val); /* Appease GCC: */ while (1) ; }
@@ -141,13 +142,13 @@ cat > link.c <<EOF
 $lui _link (const char *old, const char *new${r}link (old, new))
 EOF
 cat > lseek.c <<EOF
-$lui _lseek (int fd, int offset, int whence${r}lseek (fd, offset, whence))
+$lul _lseek (int fd, long int offset, int whence${r}lseek (fd, offset, whence))
 EOF
 cat > open.c <<EOF
 $lui _open (const char *fnam, int flags, int mode${r}open (fnam, flags, mode))
 EOF
 cat > read.c <<EOF
-$lui _read (int fd, char *buf, int nbytes${r}read (fd, buf, nbytes))
+$lui _read (int fd, void *buf, unsigned long int nbytes${r}read (fd, buf, nbytes))
 EOF
 cat > rename.c <<EOF
 $lui _rename (const char *old, const char *new${r}rename (old, new))
@@ -158,8 +159,8 @@ $lu
 #define PROT_READ      0x1             /* page can be read */
 #define PROT_WRITE     0x2             /* page can be written */
 #define MAP_ANONYMOUS  0x20            /* don't use a file */
-char *
-_sbrk (int d)
+void *
+_sbrk (long int d)
 {
   static long last_alloc = 0;
 
@@ -260,6 +261,6 @@ cat > wait.c <<EOF
 $lui _wait (int *status${r}wait4 (_getpid(), status, 0, 0))
 EOF
 cat > write.c <<EOF
-$lui _write (int fd, char *buf, int nbytes${r}write (fd, buf, nbytes))
+$lui _write (int fd, const void *buf, unsigned long int nbytes${r}write (fd, buf, nbytes))
 EOF
 exit 0
index 48489edd3700b1a8c455d19bf13c88c9ce747a05..0aae3c279719d7bddcabe606db3d3cf59ff243d4 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for cris*-axis-linux-gnu and src/sim/cris simulator.
-   Copyright (C) 2000-2005, 2017 Axis Communications.
+   Copyright (C) 2000-2005, 2017, 2023 Axis Communications.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,7 @@
 
 #include "linunistd.h"
 #include "newlib.h"
+#include <stdlib.h>
 
 #ifdef _HAVE_INITFINI_ARRAY
 #define _init __libc_init_array
@@ -99,6 +100,7 @@ extern void _Libdtors (void);
 
 extern void __init__start (void) __attribute ((weak));
 extern void __aout__ctors (void) __attribute ((weak));
+extern int main (int argc, char **argv, char **env);
 
 static void start1 () __asm__ ("__start1") __attribute ((__used__));
 static void
index 3a6f318a370fd8a11cbda5b2d1d56ef0583704d0..b627670f5ba1d06e11271d45cb047e3deb3f4c44 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for syscalls for cris*-axis-linux-gnu and simulators
-   Copyright (C) 1998-2005, 2018 Axis Communications.
+   Copyright (C) 1998-2005, 2018, 2023 Axis Communications.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
 #ifndef _ASM_ELINUX_UNISTD_H_
 #define _ASM_ELINUX_UNISTD_H_
 
+#define _LIBC
+
 /* Our callers might want to use link_warning, so provide it from here.  */
 #include "../config.h"
 #include "libnosys/warning.h"
 
+#include <unistd.h>
 #include <errno.h>
 
 /*
@@ -357,7 +360,7 @@ static inline _syscall0(int,setup)
 static inline _syscall0(int,sync)
 static inline _syscall3(int,write,int,fd,const char *,buf,unsigned,count)
 static inline _syscall1(int,dup,int,fd)
-static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
+static inline _syscall3(int,execve,const char *,file,char *const *,argv,char *const *,envp)
 static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
 static inline _syscall1(int,close,int,fd)
 static inline _syscall1(int,_exit,int,exitcode)
index 1cb686b9687b2fa7f146ce9731ecf476e966f8a2..210339f8ef18a7c23b56a24b6bdc77d08536ba69 100644 (file)
@@ -1,7 +1,7 @@
 /* Low-level kind-of-support for CRIS.  Mostly used as a placeholder
    function.  Too small and obvious to warrant a copyright notice.  */
 
-#include <stdio.h>
+#include <unistd.h>
 void
 outbyte (int ch)
 {
This page took 0.032188 seconds and 5 git commands to generate.