From 6cfc4dac7a8962bc49b88c9cb75156c7b6abd5c1 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 7 Apr 2017 14:02:15 +0200 Subject: 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 --- powerpc/AsmToJSON.ml | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'powerpc/AsmToJSON.ml') 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 -- cgit