diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-04-07 14:02:15 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-04-07 14:08:33 +0200 |
commit | 6cfc4dac7a8962bc49b88c9cb75156c7b6abd5c1 (patch) | |
tree | 2e722cdf3c3153f1a22297c429a91c887bd63a6a /powerpc | |
parent | 2086ba4770d435a084c65410ab061591e1a36c33 (diff) | |
download | compcert-6cfc4dac7a8962bc49b88c9cb75156c7b6abd5c1.tar.gz compcert-6cfc4dac7a8962bc49b88c9cb75156c7b6abd5c1.zip |
Do not generate code for "inline definitions"
ISO C99 states that "inline defintions", functions with inline
specifier that are not extern, does not provide an external
definition and another compilation unit can contain an external
definition. Thus in the case of non-static inline functions no
code should be generated.
Bug 21343
Diffstat (limited to 'powerpc')
-rw-r--r-- | powerpc/AsmToJSON.ml | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/powerpc/AsmToJSON.ml b/powerpc/AsmToJSON.ml index 5304b967..d46b7849 100644 --- a/powerpc/AsmToJSON.ml +++ b/powerpc/AsmToJSON.ml @@ -300,27 +300,29 @@ let p_int_opt oc = function let p_fundef oc (name,f) = - let alignment = atom_alignof name - and inline = atom_is_inline name - and static = atom_is_static name - and c_section,l_section,j_section = match (atom_sections name) with [a;b;c] -> a,b,c | _ -> assert false in - output_string oc "{"; - p_jmember oc "Fun Name" p_atom name; - p_sep oc; - p_jmember oc "Fun Storage Class" p_storage static; - p_sep oc; - p_jmember oc "Fun Alignment" p_int_opt alignment; - p_sep oc; - p_jmember oc "Fun Section Code" p_section c_section; - p_sep oc; - p_jmember oc "Fun Section Literals" p_section l_section; - p_sep oc; - p_jmember oc "Fun Section Jumptable" p_section j_section; - p_sep oc; - p_jmember oc "Fun Inline" p_jbool inline; - p_sep oc; - p_jmember oc "Fun Code" (fun oc a -> fprintf oc "[%a]" p_instruction a) f.fn_code; - output_string oc "}\n" + if not (is_inline_function name) then begin + let alignment = atom_alignof name + and inline = atom_is_inline name + and static = atom_is_static name + and c_section,l_section,j_section = match (atom_sections name) with [a;b;c] -> a,b,c | _ -> assert false in + output_string oc "{"; + p_jmember oc "Fun Name" p_atom name; + p_sep oc; + p_jmember oc "Fun Storage Class" p_storage static; + p_sep oc; + p_jmember oc "Fun Alignment" p_int_opt alignment; + p_sep oc; + p_jmember oc "Fun Section Code" p_section c_section; + p_sep oc; + p_jmember oc "Fun Section Literals" p_section l_section; + p_sep oc; + p_jmember oc "Fun Section Jumptable" p_section j_section; + p_sep oc; + p_jmember oc "Fun Inline" p_jbool inline; + p_sep oc; + p_jmember oc "Fun Code" (fun oc a -> fprintf oc "[%a]" p_instruction a) f.fn_code; + output_string oc "}\n" + end let p_init_data oc = function | Init_int8 ic -> p_jsingle_object oc "Init_int8" p_int ic |