svn commit: r311929 - head/sys/boot/common
Dimitry Andric
dim at FreeBSD.org
Wed Jan 11 22:11:07 UTC 2017
On 11 Jan 2017, at 22:42, Ian Lepore <ian at FreeBSD.org> wrote:
>
> On Wed, 2017-01-11 at 13:35 -0800, Ngie Cooper wrote:
>> On Wed, Jan 11, 2017 at 10:47 AM, Dimitry Andric <dim at freebsd.org>
>> wrote:
>>>
>>> Author: dim
>>> Date: Wed Jan 11 18:47:00 2017
>>> New Revision: 311929
>>> URL: https://svnweb.freebsd.org/changeset/base/311929
>>>
>>> Log:
>>> Don't include <errno.h> in reloc_elf.c, as it includes <stand.h>
>>> just
>>> after it, which has a conflicting definition of errno. This
>>> leads to
>>> the following warning with clang 4.0.0:
>>>
>>> In file included from sys/boot/common/reloc_elf32.c:6:
>>> In file included from sys/boot/common/reloc_elf.c:37:
>>> /usr/obj/usr/src/tmp/usr/include/stand.h:155:12: error: this
>>> function declaration is not a prototype [-Werror,-Wstrict-
>>> prototypes]
>>> extern int errno;
>>> ^
>>> sys/sys/errno.h:46:26: note: expanded from macro 'errno'
>>> #define errno (* __error())
>> It seems like libstand (once again) should be fixed, not the
>> "offending code".
>> -Ngie
>>
>
> In this case it's not the library that's in error. Libstand is the
> thing that implements errno, so it's the thing that must define it.
>
> The code that includes both errno.h and libstand.h was wrong. errno.h
> is a standard header file used with libc, and the loader code doesn't
> link with libc.
>
> The thing that amazes me is the usual: how did this ever work with gcc
> 4.2?
The line:
extern int errno;
expanded to:
extern int (* __error());
which is a declaration of an external function pointer called __error
(albeit with an empty parameter list). Since nobody actually refers to
this symbol in libstand, there are no later complaints.
Interestingly, reloc_elf.c does not use errno at all, so I have no idea
why the include was originally added.
-Dimitry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20170111/ced15b84/attachment.sig>
More information about the svn-src-head
mailing list