Message: 1
Date: Sun, 05 Aug 2012 17:20:49 -0400
From: Tarl Neustaedter <tarl-b2@tarl.net>
To: The OpenBIOS Mailinglist <openbios@openbios.org>
Subject: Re: [OpenBIOS] Bug in file unix.c
Message-ID: <501EE3B1.6090407@tarl.net>
Content-Type: text/plain; charset=windows-1252; format=flowed
On 2012-Aug-5 15:36 , Programmingkid wrote:
I was trying to build openbios on Ubuntu 10.10 when I received this error message:
CC target/arch/unix/unix.o
cc1: warnings being treated as errors
../arch/unix/unix.c: In function ?read_from_disk?:
../arch/unix/unix.c:382: error: ignoring return value of ?read?, declared with attribute warn_unused_result
make[1]: *** [target/arch/unix/unix.o] Error 1
make[1]: Leaving directory `/home/user/Desktop/openbios-devel/obj-x86'
make: *** [build-verbose] Error 1
This is the command I used to build openbios:
./config/scripts/switch-arch unix-x86
That looks like your version of the C compiler has the ultra-pedantic
errors turned on.
Ignoring the return value for a function that returns one is (or at
least used to be) legal C. Some recent compilers have decided to make it
a fatal error. The fix is to place (void) in front of the particular
invocation, to signal that yes, you know it returns a value, you've
thought about it carefully, and you don't give a crap what the value is,
and you still want to call this function without paying attention to the
return value.
As you may have gathered, I'm not a fan of this particular error check.
It ends up cluttering code with lots of irrelevant casting. Since I
regard casting as an indication of code weakness, adding piles of
irrelevant casts (in my opinion) makes the code weaker - because it's
harder to focus on the areas which actually are weak.
Still, this issue should be fixed. It does sound easy to fix and would make things a lot easier for anyone else who needed to build OpenBIOS on Ubuntu.