[Top][All Lists]

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

[Chicken-hackers] [PATCH] Use noreturn attribute in clang versions which

From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Use noreturn attribute in clang versions which support it
Date: Mon, 21 Oct 2013 22:27:55 +0200
User-agent: Mutt/

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.

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


Attachment: 0001-Use-noreturn-attribute-in-newer-clang-versions-and-g.patch
Description: Text document

reply via email to

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