[cfe-users] Pure attribute

Daniel Mosesson dmosess1 at binghamton.edu
Mon Mar 10 16:01:29 PDT 2014


Sorry, I missed the warning.

The below compiles with no warning about the attribute (it does warn about a missing prototype). Changing pure to garbage made it complain about an unknown attribute, and making it modify a global did not change anything.

__attribute((pure))
int f(){return 5;}

int main(){}

Is this documented?

-----Original Message-----
From: Seth Cantrell [mailto:seth.cantrell at gmail.com]
Sent: Monday, March 10, 2014 5:59 PM
To: Daniel Mosesson
Cc: cfe-users at cs.uiuc.edu
Subject: Re: [cfe-users] Pure attribute

Unless this attribute has been added since last week I don't think it is supported. I get a warning "unknown attribute 'pure' ignored".

You might try compiling a test program which should fail due to not being pure, rather than one which should work. That's a better test to see if the attribute does anything. You can also use the -Weverything flag to be sure you see any warnings.

> On Mar 10, 2014, at 1:54 PM, Daniel Mosesson <dmosess1 at binghamton.edu> wrote:
>
> As far as I can tell, the pure attribute works (the following code 
> compiles), but where is the documentation for it?
>
> [[clang::pure]]
> int f(){return 5;}
> int main() {
>    return 0;
> }
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users






More information about the cfe-users mailing list