[OpenBIOS] Bug in file unix.c

Tarl Neustaedter tarl-b2 at tarl.net
Sun Aug 5 23:20:49 CEST 2012

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.

More information about the OpenBIOS mailing list