Subject: Re: bogus CC warning?
To: None <current-users@netbsd.org>
From: Aidan Cully <aidan@kublai.com>
List: current-users
Date: 04/04/1999 16:55:51
Thanks to a message from Jonathan Stone, I was able to figure out how
to reproduce this problem in exportable code..  Here's a .c file which
will (on my box) reproduce the results I'm seeing.  The output I get
when compiling is:
albatross:~/src/warn-test% cc -o test -Wall -Werror test.c 
cc1: warnings being treated as errors
test.c: In function `main':
test.c:13: warning: passing arg 1 of `proto' from incompatible pointer type
test.c: In function `proto':
test.c:22: warning: comparison of distinct pointer types lacks a cast
test.c:24: warning: passing arg 1 of `proto' from incompatible pointer type
The source for the program:

#include <string.h>
#include <stdio.h>

typedef unsigned char array[256];
void proto(const array *string, array *string2);

int main(int argc, char *argv[])
{
    array str1, str2;

    strcpy((char*) str1, "Hello, world!");
    strcpy((char*) str2, "Hello, new world!");
    proto(&str1, &str2);
    return(0);
}

void proto(string, string2)
    const array *string;
    array *string2;
{
    printf("string: %s\n", (char*) string);
    if (string == string2)
        return;
    proto(string2, string2);
}

Does anyone else get these results?

Thanks again,
--aidan