This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Fix compiler warning on some syscalls
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 7 Jan 2015 15:31:50 -0800 (PST)
- Subject: Re: [PATCH] powerpc: Fix compiler warning on some syscalls
- Authentication-results: sourceware.org; auth=none
- References: <54ABDECE dot 3030306 at linux dot vnet dot ibm dot com> <87387ot233 dot fsf at igel dot home> <54ABFAD6 dot 8020008 at linux dot vnet dot ibm dot com> <54AC0560 dot 60707 at cs dot ucla dot edu> <54AC160F dot 6030403 at linux dot vnet dot ibm dot com>
Using &foo[0] is fine, but I think it does need a comment in each place.
It doesn't have to be a full explanation, just something short like:
/* Avoid implicit array coercion in syscall macros. */
Otherwise someone will come along at some point and say, "&foo[0] is
equivalent to foo in C, so I'll remove the superfluous operators."
A more full explanation can go with the definition of INLINE_SYSCALL et al.
It wouldn't hurt for at least some of those implementations to add a
__builtin_classify_type check so that any array_type_class arguments to
syscall macros (at least in machine-independent code) barf at compile time
in a way that leads to seeing a comment that explains the situation.
Thanks,
Roland