CIL mishandles several GCC attributes that *should* only be associated
with functions: leaf, artificial, and warn_unused_result.  The attached
patch fixes this by adding them to CIL's table of known function attributes.

These three attributes are all heavily used in <stdio.h> under Fedora 17
(glibc 2.15) when optimization is turned on.  Without this fix, these
attributes tend to be incorrectly associated with functions' return
types, which in turn leads to GCC warnings about incorrect attribute use.

Would someone please apply this to the main CIL repository?  Thanks!

As an aside, I *used* to have direct commit access to the CIL
repository.  You'll even see my name listed in the "LICENSE" file as one
of the copyright holders.  But either I no longer have commit rights or
else I know longer know what I am supposed to do to exercise those
rights.  A git push to
<ssh://lib...@cil.git.sourceforge.net/gitroot/cil/cil> fails with
"insufficient permission for adding an object to repository database
./objects".  Am I doing this wrong?  Do I still have commit rights in
theory, or am I no longer considered a CIL developer?

-- Ben
commit 0e490af4c7685afc5754faa346753082942cef05
Author: Ben Liblit <lib...@cs.wisc.edu>
Date:   Thu May 10 11:36:44 2012 -0500

    Add several GCC attributes that should only be associated with functions:
    leaf, artificial, and warn_unused_result.  These are all heavily used in
    <stdio.h> under Fedora 17 (glibc 2.15) when optimization is turned on.
    Without this fix, these attributes tend to be incorrectly associated with
    functions' return types, which in turn leads to GCC warnings about
    incorrect attribute use.

diff --git a/src/cil.ml b/src/cil.ml
index f2cc107..fe2132f 100755
--- a/src/cil.ml
+++ b/src/cil.ml
@@ -1395,7 +1395,9 @@ let attributeHash: (string, attributeClass) H.t =
 
   List.iter (fun a -> H.add table a (AttrFunType false))
     [ "format"; "regparm"; "longcall"; 
-      "noinline"; "always_inline"; ];
+      "noinline"; "always_inline"; "leaf";
+      "artificial"; "warn_unused_result";
+    ];
 
   List.iter (fun a -> H.add table a (AttrFunType true))
     [ "stdcall";"cdecl"; "fastcall" ];
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to