chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Use noreturn attribute in clang versions w


From: Jim Ursetto
Subject: Re: [Chicken-hackers] [PATCH] Use noreturn attribute in clang versions which support it
Date: Wed, 23 Oct 2013 08:51:16 -0500

On Oct 21, 2013, at 15:27, Peter Bex <address@hidden> wrote:
> 
> Hi all,
> 
> Here's another small patch which will properly enable C_noret for clang.
> Currently it expands to nothing and causes a slew of warnings mostly
> because it doesn't understand that barf() won't return when it detects
> an error, and that will leave many variables uninitialised.  Luckily,
> clang has nice feature checking macros (builtins) which allow you to
> detect which features are available.  Damn, clang is nice!
> 
> Anyway, I've added a __has_attribute definition for other compilers
> so they won't die on #if defined(__clang__) && !__has_attribute(noreturn)
> Not adding this would further complicated the logic, I think.
> 
> Fixing this got rid of all the warnings, except one, which exposed
> a small bug which is also a minor inefficiency: C_2_divide will call
> C_fix() on an integer value, which in case of flonums will not be
> initialised.  In cases of flonums, it will be initialised, but it will
> get C_fix()ed and immediately C_unfix()ed afterwards.  This is
> unnecessary and wrong, so I've moved the C_fix() call to occur after
> the check.
> 
> Perhaps this patch can also go into stability.  It's not important,
> but probably a good idea so users compiling with clang won't get
> spurious warnings.

Makes sense, let me check my notes as to why I took noreturn out -- I had to do 
this to get clang to work. Hopefully the feature test fixes the issue. noreturn 
isn't just for aesthetics you see -- it leaves out the assembly language return 
code stanza that is normally generated, saving quite a bit of code size in CPS 
style code.

> Sorry if this mail is a little rambling, I'm slightly ill right now.

It's that season.
Jim


reply via email to

[Prev in Thread] Current Thread [Next in Thread]