[Nickle] nickle: Branch 'master'
Keith Packard
keithp at keithp.com
Fri Nov 25 11:35:18 PST 2011
alarm.c | 2 +-
builtin-pid.c | 25 +++++++++++++------------
builtin.c | 3 ++-
configure.in | 9 +++------
edit.c | 10 ++++++----
file.c | 5 +++--
io.c | 2 +-
lex.l | 3 ++-
main.c | 19 ++++++++++---------
nickle.h | 4 ++--
pretty.c | 5 -----
profile.c | 2 +-
rational.c | 4 ++--
13 files changed, 46 insertions(+), 47 deletions(-)
New commits:
commit a60ad0adac6a338839e4e6194838f5918dfa0953
Author: Keith Packard <keithp at keithp.com>
Date: Fri Nov 25 11:33:52 2011 -0800
Clean up a pile of build warnings
Signal return types, unused return values and stepping off the end of
the typePrim array (the value of which was unused anyways).
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/alarm.c b/alarm.c
index dad7f44..7183535 100644
--- a/alarm.c
+++ b/alarm.c
@@ -146,7 +146,7 @@ do_sleep (Value ms)
ReferencePtr SleepingReference;
-static RETSIGTYPE
+static void
_CatchAlarm (int sig)
{
resetSignal (SIGALRM, _CatchAlarm);
diff --git a/builtin-pid.c b/builtin-pid.c
index e0d4771..066e21d 100644
--- a/builtin-pid.c
+++ b/builtin-pid.c
@@ -48,6 +48,17 @@ do_PID_getegid (void)
}
static Value
+error (Value value)
+{
+ int err = errno;
+
+ RaiseStandardException (exception_system_error, 3,
+ FileGetErrorMessage (err),
+ NewInt (err), value);
+ return Void;
+}
+
+static Value
do_PID_getgroups (void)
{
ENTER ();
@@ -58,7 +69,8 @@ do_PID_getgroups (void)
n = getgroups (0, NULL);
list = AllocateTemp (n * sizeof (gid_t));
- getgroups (n, list);
+ if (getgroups (n, list) < 0)
+ RETURN(error(NewInt(n)));
ret = NewArray (False, False, typePrim[rep_integer], 1, &n);
for (i = 0; i < n; i++)
ArrayValueSet(&ret->array, i, NewInt (list[i]));
@@ -73,17 +85,6 @@ do_PID_getpid (void)
}
static Value
-error (Value value)
-{
- int err = errno;
-
- RaiseStandardException (exception_system_error, 3,
- FileGetErrorMessage (err),
- NewInt (err), value);
- return Void;
-}
-
-static Value
do_PID_setuid (Value uid)
{
ENTER ();
diff --git a/builtin.c b/builtin.c
index b0cfc11..c0fb919 100644
--- a/builtin.c
+++ b/builtin.c
@@ -193,7 +193,8 @@ BuiltinType (char *format, Type **type, Bool arg)
break;
default:
t = 0;
- write (2, "Invalid builtin argument type\n", 30);
+ i = write (2, "Invalid builtin argument type\n", 30);
+ (void) i;
break;
}
if (ref)
diff --git a/configure.in b/configure.in
index a2941f0..ac54f95 100644
--- a/configure.in
+++ b/configure.in
@@ -4,12 +4,9 @@ dnl Copyright © 1988-2004 Keith Packard and Bart Massey.
dnl All Rights Reserved. See the file COPYING in this directory
dnl for licensing information.
-AC_PREREQ(2.59)
+AC_PREREQ([2.68])
-AC_INIT([nickle],
- 2.71,
- [http://nickle.org],
- nickle)
+AC_INIT([nickle],[2.71],[http://nickle.org],[nickle])
AC_CONFIG_SRCDIR([nickle.h])
AC_CONFIG_HEADERS([config.h])
@@ -98,7 +95,7 @@ case "$ac_cv_header_stdint_h" in
esac
dnl Checks for library functions.
-AC_TYPE_SIGNAL
+
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(unsetenv setenv putenv gettimeofday hstrerror select)
AC_CHECK_FUNCS(sigaction sigrelse sigignore setrlimit getrlimit)
diff --git a/edit.c b/edit.c
index 35f4fb1..c4a506e 100644
--- a/edit.c
+++ b/edit.c
@@ -22,11 +22,12 @@
#define DEFAULT_EDITOR "ed"
#endif
-static void
+static int
edit (char *file_name)
{
char buf[1024];
char *editor;
+ int ret;
if (!(editor = getenv ("EDITOR")))
editor = DEFAULT_EDITOR;
@@ -34,8 +35,9 @@ edit (char *file_name)
file_name = "";
(void) sprintf (buf, "%s %s", editor, file_name);
IoStop ();
- (void) system (buf);
+ ret = system (buf);
IoStart ();
+ return ret;
}
void
@@ -65,8 +67,8 @@ EditFunction (SymbolPtr symbol, Publish publish)
{
PrettyPrint (tmp, publish, symbol);
(void) FileClose (tmp);
- edit (nickleName);
- LexFile (nickleName, True, False);
+ if (edit (nickleName) == 0)
+ LexFile (nickleName, True, False);
}
(void) unlink (nickleName);
}
diff --git a/file.c b/file.c
index 11c344f..8dbdd7c 100644
--- a/file.c
+++ b/file.c
@@ -452,7 +452,7 @@ FileInitErrors (void)
volatile Bool signalChild;
-static RETSIGTYPE
+static void
sigchld (int sig)
{
resetSignal (SIGCHLD, sigchld);
@@ -831,7 +831,8 @@ FileFilter (char *program, char *args[], Value filev, int *errp)
fcntl (errpipe[1], F_SETFD, FD_CLOEXEC);
execvp (program, args);
errcode = errno & 0xff;
- write (errpipe[1], &errcode, 1);
+ errcode = write (errpipe[1], &errcode, 1);
+ (void) errcode;
exit (1);
}
/* parent */
diff --git a/io.c b/io.c
index 07abe4a..f3d08d1 100644
--- a/io.c
+++ b/io.c
@@ -26,7 +26,7 @@ Bool anyFileWriteBlocked;
#define RESTART_SIGNAL(sig,func) (void) signal (sig,func)
#endif
-static RETSIGTYPE
+static void
sigio (int sig)
{
resetSignal (SIGIO, sigio);
diff --git a/lex.l b/lex.l
index 2f51c80..4b4bc2c 100644
--- a/lex.l
+++ b/lex.l
@@ -323,7 +323,7 @@ auto { yylval.class = class_auto; return AUTO; }
const { yylval.class = class_const; return CONST; }
global { yylval.class = class_global; return GLOBAL; }
static { yylval.class = class_static; return STATIC; }
-function { yylval.type = typePrim[rep_func]; return FUNCTION; }
+function { yylval.type = typePrim[rep_void]; return FUNCTION; }
while { yylval.ints = WHILE; return WHILE; }
for { yylval.ints = FOR; return FOR; }
do { yylval.ints = DO; return DO; }
@@ -673,6 +673,7 @@ lexdoc (void)
int c;
Value s = NewStrString ("");
+ (void) yyunput;
c = input();
if (lexInput->at_eof)
{
diff --git a/main.c b/main.c
index b6ca4f1..8190f9d 100644
--- a/main.c
+++ b/main.c
@@ -57,8 +57,8 @@ try_nicklestart (void)
return LexFile (nicklestart, True, False);
}
-RETSIGTYPE intr(int), ferr(int);
-RETSIGTYPE stop (int), die (int), segv (int);
+void intr(int), ferr(int);
+void stop (int), die (int), segv (int);
static void
ignoreSignal(int sig) {
@@ -130,7 +130,7 @@ init (void)
}
void
-catchSignal (int sig, RETSIGTYPE (*func) (int sig))
+catchSignal (int sig, void (*func) (int sig))
{
#ifdef HAVE_SIGACTION
struct sigaction sa;
@@ -145,7 +145,7 @@ catchSignal (int sig, RETSIGTYPE (*func) (int sig))
}
void
-resetSignal (int sig, RETSIGTYPE (*func) (int sig))
+resetSignal (int sig, void (*func) (int sig))
{
#ifndef HAVE_SIGACTION
signal (sig, func);
@@ -154,18 +154,19 @@ resetSignal (int sig, RETSIGTYPE (*func) (int sig))
volatile Bool signalInterrupt;
-RETSIGTYPE
+void
intr (int sig)
{
resetSignal (SIGINT, intr);
if (signalInterrupt) {
- write(2,"Double interrupt, exiting\n", 26);
+ int ret = write(2,"Double interrupt, exiting\n", 26);
+ (void) ret;
exit(1);
}
SetSignalInterrupt ();
}
-RETSIGTYPE
+void
stop (int sig)
{
sigset_t set, oset;
@@ -183,14 +184,14 @@ stop (int sig)
catchSignal (sig, stop);
}
-RETSIGTYPE
+void
die (int sig)
{
IoStop ();
_exit (sig);
}
-RETSIGTYPE
+void
segv (int sig)
{
IoStop ();
diff --git a/nickle.h b/nickle.h
index 3ee5600..a9564ad 100644
--- a/nickle.h
+++ b/nickle.h
@@ -768,10 +768,10 @@ void intr(int);
void stop (int), die (int), segv (int);
void
-catchSignal (int sig, RETSIGTYPE (*func) (int sig));
+catchSignal (int sig, void (*func) (int sig));
void
-resetSignal (int sig, RETSIGTYPE (*func) (int sig));
+resetSignal (int sig, void (*func) (int sig));
extern Value yyinput;
diff --git a/pretty.c b/pretty.c
index cc3ae09..d435116 100644
--- a/pretty.c
+++ b/pretty.c
@@ -580,7 +580,6 @@ static void
_PrettyCatch (Value f, Expr *e, int level, Bool nest)
{
CodePtr catch;
- Atom name;
if (!e)
return;
@@ -589,10 +588,6 @@ _PrettyCatch (Value f, Expr *e, int level, Bool nest)
PrettyIndent (f, 0, level);
e = e->tree.right;
catch = e->code.code;
- if (catch->base.name->base.tag == COLONCOLON)
- name = catch->base.name->tree.right->atom.atom;
- else
- name = catch->base.name->atom.atom;
FilePuts (f, "catch ");
PrettyExpr (f, catch->base.name, 0, level, nest);
FilePuts (f, " ");
diff --git a/profile.c b/profile.c
index b66255d..8fef00d 100644
--- a/profile.c
+++ b/profile.c
@@ -17,7 +17,7 @@ volatile Bool signalProfile;
static unsigned long previousTick;
Bool profiling;
-static RETSIGTYPE
+static void
sigprofile (int sig)
{
resetSignal (SIGVTALRM, sigprofile);
diff --git a/rational.c b/rational.c
index ef06bf5..e7a48b7 100644
--- a/rational.c
+++ b/rational.c
@@ -172,7 +172,7 @@ RationalMod (Value av, Value bv, int expandOk)
{
ENTER ();
Rational *a = &av->rational, *b = &bv->rational;
- Natural *rem, *quo, *div;
+ Natural *rem, *div;
if (NaturalZero (b->num))
{
@@ -181,7 +181,7 @@ RationalMod (Value av, Value bv, int expandOk)
RETURN (Void);
}
div = NaturalTimes (b->num, a->den);
- quo = NaturalDivide (NaturalTimes (a->num, b->den), div, &rem);
+ (void) NaturalDivide (NaturalTimes (a->num, b->den), div, &rem);
if (a->sign == Negative && !NaturalZero (rem))
rem = NaturalMinus (div, rem);
RETURN (NewRational (Positive, rem, NaturalTimes (a->den, b->den)));
More information about the Nickle
mailing list