Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [Patch] make cpsw work on another eval board



On Feb 26, 10:23am, ozaki-r%NetBSD.org@localhost (Ryota Ozaki) wrote:
-- Subject: Re: [Patch] make cpsw work on another eval board

| Christos, thank you for reviewing again!
| 
| I've updated the patches to meet your requests.

Thanks!

'uint8_t *const foo' should be 'const uint8_t *foo'; we want the contents
to be read-only not just the pointer; 'char *const x' means 'x = 0' is not
allowed; we want '*x = 0' not to be allowed, so we want 'const char *x'.

Eg.

$ cat << _EOF > foo.c
static void
foo(char * const x) {
        *x = 1;
}

int
main(void)
{
        foo("bar");
        return 0;
}
_EOF
$ cc -Wall -Wwrite-strings -Wextra foo.c
foo.c: In function 'main':
foo.c:9:2: warning: passing argument 1 of 'foo' discards qualifiers from 
pointer target type
foo.c:2:1: note: expected 'char * const' but argument is of type 'const char *'

Fix that and commit it I guess.

christos


Home | Main Index | Thread Index | Old Index