|
From: | John W. Eaton |
Subject: | Re: Positioning GCC_ATTR_DEPRECATED |
Date: | Tue, 29 Dec 2015 15:35:39 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 |
On 12/27/2015 07:34 PM, John W. Eaton wrote:
On 12/26/2015 11:20 PM, Rik wrote:12/26/15 I would not have necessarily thought of this, but for the fact that this is already being done in ov.h. For example, GCC_ATTR_DEPRECATED octave_idx_type capacity (void) const versus octave_value (const charMatrix& chm, bool is_string, char type = '\'') GCC_ATTR_DEPRECATED;I didn't realize that it could be anywhere except the end. If it can be at the beginning, then move it there. May as well move all of them. How about putting it at the beginning on a separate line?
After looking at this a bit more, I found that attributes can be applied to function definitions as well as declarations, but only if they appear before the function name. So something like
static void foobar (void) __attribute__ ((noreturn)) { ... } fails to compile, but __attribute__ ((noreturn)) static void foobar (void) { ... }is OK. I recently added separate declarations for some static functions just so that I could tag them with the noreturn attribute. But now I see that I could have avoided teh duplication. I'll fix that.
Also, with C++11, "[[noreturn]]" is the standard way of specifying the noreturn attribute.
So I think we should rename GCC_ATTR_NORETURN to be OCTAVE_ATTR_NORETURN (or something that does not appear to be specific to GCC) and then move all these attributes to be the first thing in the function declaration (or definition).
jwe
[Prev in Thread] | Current Thread | [Next in Thread] |