scsh-users
[Top] [All Lists]

Compilation error in io.c, in scsh-0.6.6

To: scsh-users@scsh.net
Subject: Compilation error in io.c, in scsh-0.6.6
From: nisse@lysator.liu.se (Niels Möller)
Date: Wed, 23 Nov 2005 11:05:41 +0100 (MET)
List-id: <scsh-users.list-id.scsh.net>
Old-date: 23 Nov 2005 11:05:28 +0100
I just build scsh-0.6.6 on SunOS-5.10, sparc, using gcc-4.0.1. I had
to apply the below patch to c/unix/io.c; apperantly gcc doesn't like
function local static declarations of functions. (I'm not sure what
the C specification says about this code, but I'd consider function
declarations anywhere but on top level as bad style even if it is
allowed).

Error message:

  gcc -c -DHAVE_CONFIG_H -I./c -I./cig  -O2 -mcpu=v9 -o c/unix/io.o
  c/unix/io.c
  c/unix/io.c: In function 'ps_write_integer':
  c/unix/io.c:154: error: invalid storage class for function 'write_integer'
  c/unix/io.c: At top level:
  c/unix/io.c:171: error: conflicting types for 'write_integer'
  c/unix/io.c:160: error: previous implicit declaration of 'write_integer' was 
here
  make: *** [c/unix/io.o] Error 1

Moving the declaration to top-level solves the problem.

Best regards,
/Niels Möller

--- io.c-original       1999-09-14 14:44:54.000000000 +0200
+++ io.c        2005-11-23 10:12:24.424359000 +0100
@@ -146,13 +146,13 @@ ps_write_char(char ch, FILE *port)
       return 0; }
 }
 
+static long write_integer(unsigned long n, FILE *port);
+
 long
 ps_write_integer(long n, FILE *port)
 {
   int status;
 
-  static long write_integer(unsigned long n, FILE *port);
-
   if (n == 0) {
     WRITE_CHAR('0', port, status);
     return status; }

<Prev in Thread] Current Thread [Next in Thread>