Add some checks for gcc around a few function declarations and note the

unused variables. Also fix a few other warnings that PR#22118 shows when
trying to compile bmake on non-NetBSD hosts
This commit is contained in:
jmc 2004-07-01 04:39:30 +00:00
parent 25662013ee
commit 71a252d58b
8 changed files with 127 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: arch.c,v 1.40 2004/05/07 00:04:38 ross Exp $ */
/* $NetBSD: arch.c,v 1.41 2004/07/01 04:39:30 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: arch.c,v 1.40 2004/05/07 00:04:38 ross Exp $";
static char rcsid[] = "$NetBSD: arch.c,v 1.41 2004/07/01 04:39:30 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: arch.c,v 1.40 2004/05/07 00:04:38 ross Exp $");
__RCSID("$NetBSD: arch.c,v 1.41 2004/07/01 04:39:30 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -1031,7 +1031,11 @@ Arch_Touch(GNode *gn)
*-----------------------------------------------------------------------
*/
void
#if __GNUC__ && !defined(RANLIBMAG)
Arch_TouchLib(GNode *gn __attribute__((unused)))
#else
Arch_TouchLib(GNode *gn)
#endif
{
#ifdef RANLIBMAG
FILE * arch; /* Stream open to archive */

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.54 2004/05/07 08:12:15 sjg Exp $ */
/* $NetBSD: compat.c,v 1.55 2004/07/01 04:39:30 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: compat.c,v 1.54 2004/05/07 08:12:15 sjg Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.55 2004/07/01 04:39:30 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: compat.c,v 1.54 2004/05/07 08:12:15 sjg Exp $");
__RCSID("$NetBSD: compat.c,v 1.55 2004/07/01 04:39:30 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -230,6 +230,7 @@ CompatRunCommand(ClientData cmdp, ClientData gnp)
#if __GNUC__
(void) &av;
(void) &errCheck;
(void) &cmd;
#endif
silent = gn->type & OP_SILENT;
errCheck = !(gn->type & OP_IGNORE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.41 2004/05/07 00:04:38 ross Exp $ */
/* $NetBSD: dir.c,v 1.42 2004/07/01 04:39:30 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: dir.c,v 1.41 2004/05/07 00:04:38 ross Exp $";
static char rcsid[] = "$NetBSD: dir.c,v 1.42 2004/07/01 04:39:30 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: dir.c,v 1.41 2004/05/07 00:04:38 ross Exp $");
__RCSID("$NetBSD: dir.c,v 1.42 2004/07/01 04:39:30 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -860,7 +860,12 @@ Dir_Expand(const char *word, Lst path, Lst expansions)
*-----------------------------------------------------------------------
*/
static char *
#if __GNUC__
DirLookup(Path *p, const char *name __attribute__((unused)), const char *cp,
Boolean hasSlash __attribute__((unused)))
#else
DirLookup(Path *p, const char *name, const char *cp, Boolean hasSlash)
#endif
{
char *file; /* the current filename to check */
@ -1002,7 +1007,12 @@ DirLookupAbs(Path *p, const char *name, const char *cp)
*-----------------------------------------------------------------------
*/
static char *
#if __GNUC__
DirFindDot(Boolean hasSlash __attribute__((unused)), const char *name,
const char *cp)
#else
DirFindDot(Boolean hasSlash, const char *name, const char *cp)
#endif
{
if (Hash_FindEntry (&dot->files, cp) != (Hash_Entry *)NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.85 2004/05/07 08:12:15 sjg Exp $ */
/* $NetBSD: job.c,v 1.86 2004/07/01 04:39:30 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: job.c,v 1.85 2004/05/07 08:12:15 sjg Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.86 2004/07/01 04:39:30 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: job.c,v 1.85 2004/05/07 08:12:15 sjg Exp $");
__RCSID("$NetBSD: job.c,v 1.86 2004/07/01 04:39:30 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -462,7 +462,11 @@ JobCondPassSig(ClientData jobp, ClientData signop)
*-----------------------------------------------------------------------
*/
static void
#if __GNUC__
JobChildSig(int signo __attribute__((unused)))
#else
JobChildSig(int signo)
#endif
{
write(exit_pipe[1], ".", 1);
}
@ -486,7 +490,11 @@ JobChildSig(int signo)
*-----------------------------------------------------------------------
*/
static void
#if __GNUC__
JobContinueSig(int signo __attribute__((unused)))
#else
JobContinueSig(int signo)
#endif
{
JobRestartJobs();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.102 2004/05/07 00:04:38 ross Exp $ */
/* $NetBSD: main.c,v 1.103 2004/07/01 04:39:30 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.102 2004/05/07 00:04:38 ross Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.103 2004/07/01 04:39:30 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: main.c,v 1.102 2004/05/07 00:04:38 ross Exp $");
__RCSID("$NetBSD: main.c,v 1.103 2004/07/01 04:39:30 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -1075,7 +1075,11 @@ main(int argc, char **argv)
* lots
*/
static Boolean
#if __GNUC__
ReadMakefile(ClientData p, ClientData q __attribute__((unused)))
#else
ReadMakefile(ClientData p, ClientData q)
#endif
{
char *fname = p; /* makefile to read */
FILE *stream;

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.c,v 1.53 2004/05/07 00:04:39 ross Exp $ */
/* $NetBSD: make.c,v 1.54 2004/07/01 04:39:31 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: make.c,v 1.53 2004/05/07 00:04:39 ross Exp $";
static char rcsid[] = "$NetBSD: make.c,v 1.54 2004/07/01 04:39:31 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: make.c,v 1.53 2004/05/07 00:04:39 ross Exp $");
__RCSID("$NetBSD: make.c,v 1.54 2004/07/01 04:39:31 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -795,7 +795,11 @@ Make_Update(GNode *cgn)
*-----------------------------------------------------------------------
*/
static int
#if __GNUC__
MakeUnmark(ClientData cgnp, ClientData pgnp __attribute__((unused)))
#else
MakeUnmark(ClientData cgnp, ClientData pgnp)
#endif
{
GNode *cgn = (GNode *) cgnp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: targ.c,v 1.31 2004/05/07 00:04:40 ross Exp $ */
/* $NetBSD: targ.c,v 1.32 2004/07/01 04:39:31 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: targ.c,v 1.31 2004/05/07 00:04:40 ross Exp $";
static char rcsid[] = "$NetBSD: targ.c,v 1.32 2004/07/01 04:39:31 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: targ.c,v 1.31 2004/05/07 00:04:40 ross Exp $");
__RCSID("$NetBSD: targ.c,v 1.32 2004/07/01 04:39:31 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -742,7 +742,11 @@ TargPropagateCohort(ClientData cgnp, ClientData pgnp)
}
static int
#if __GNUC__
TargPropagateNode(ClientData gnp, ClientData junk __attribute__((unused)))
#else
TargPropagateNode(ClientData gnp, ClientData junk)
#endif
{
GNode *gn = (GNode *) gnp;
if (gn->type & OP_DOUBLEDEP)

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.88 2004/05/07 00:04:40 ross Exp $ */
/* $NetBSD: var.c,v 1.89 2004/07/01 04:39:31 jmc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.88 2004/05/07 00:04:40 ross Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.89 2004/07/01 04:39:31 jmc Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: var.c,v 1.88 2004/05/07 00:04:40 ross Exp $");
__RCSID("$NetBSD: var.c,v 1.89 2004/07/01 04:39:31 jmc Exp $");
#endif
#endif /* not lint */
#endif
@ -716,9 +716,15 @@ Var_Value(const char *name, GNode *ctxt, char **frp)
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarHead(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#else
VarHead(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#endif
{
char *slash;
@ -764,9 +770,15 @@ VarHead(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarTail(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#else
VarTail(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#endif
{
char *slash;
@ -806,9 +818,15 @@ VarTail(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarSuffix(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#else
VarSuffix(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#endif
{
char *dot;
@ -847,9 +865,15 @@ VarSuffix(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarRoot(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#else
VarRoot(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData dummy)
#endif
{
char *dot;
@ -891,9 +915,15 @@ VarRoot(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarMatch(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData pattern)
#else
VarMatch(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData pattern)
#endif
{
if (Str_Match(word, (char *) pattern)) {
if (addSpace && vpstate->varSpace) {
@ -980,9 +1010,15 @@ VarSYSVMatch(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarNoMatch(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData pattern)
#else
VarNoMatch(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData pattern)
#endif
{
if (!Str_Match(word, (char *) pattern)) {
if (addSpace && vpstate->varSpace) {
@ -1017,9 +1053,15 @@ VarNoMatch(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarSubstitute(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData patternp)
#else
VarSubstitute(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData patternp)
#endif
{
int wordLen; /* Length of word */
char *cp; /* General pointer */
@ -1217,9 +1259,16 @@ VarREError(int err, regex_t *pat, const char *str)
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarRESubstitute(GNode *ctx __attribute__((unused)),
Var_Parse_State *vpstate __attribute__((unused)),
char *word, Boolean addSpace, Buffer buf,
ClientData patternp)
#else
VarRESubstitute(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData patternp)
#endif
{
VarREPattern *pat;
int xrv;
@ -1357,9 +1406,16 @@ VarRESubstitute(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static Boolean
#if __GNUC__
VarLoopExpand(GNode *ctx __attribute__((unused)),
Var_Parse_State *vpstate __attribute__((unused)),
char *word, Boolean addSpace, Buffer buf,
ClientData loopp)
#else
VarLoopExpand(GNode *ctx, Var_Parse_State *vpstate,
char *word, Boolean addSpace, Buffer buf,
ClientData loopp)
#endif
{
VarLoop_t *loop = (VarLoop_t *) loopp;
char *s;
@ -1400,8 +1456,13 @@ VarLoopExpand(GNode *ctx, Var_Parse_State *vpstate,
*-----------------------------------------------------------------------
*/
static char *
#if __GNUC__
VarSelectWords(GNode *ctx __attribute__((unused)), Var_Parse_State *vpstate,
const char *str, VarSelectWords_t *seldata)
#else
VarSelectWords(GNode *ctx, Var_Parse_State *vpstate,
const char *str, VarSelectWords_t *seldata)
#endif
{
Buffer buf; /* Buffer for the new string */
Boolean addSpace; /* TRUE if need to add a space to the
@ -1660,9 +1721,15 @@ VarUniq(const char *str)
*-----------------------------------------------------------------------
*/
static char *
#if __GNUC__
VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate __attribute__((unused)),
int err, const char **tstr, int delim, int *flags,
int *length, VarPattern *pattern)
#else
VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate,
int err, const char **tstr, int delim, int *flags,
int *length, VarPattern *pattern)
#endif
{
const char *cp;
Buffer buf = Buf_Init(0);
@ -1878,7 +1945,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr,
* expanding it in a non-local context. This
* is done to support dynamic sources. The
* result is just the invocation, unaltered */
Var_Parse_State parsestate = {0}; /* Flags passed to helper functions */
Var_Parse_State parsestate; /* Flags passed to helper functions */
*freePtr = FALSE;
dynamic = FALSE;